zhenghy

播放器修改

@@ -40,7 +40,7 @@ export struct DetailPlayShortVideoPage { @@ -40,7 +40,7 @@ export struct DetailPlayShortVideoPage {
40 @Provide progressVal: number = 0; 40 @Provide progressVal: number = 0;
41 @Provide videoLandScape?: number = 1; // 视频朝向, 横屏视频:1;竖屏视频:2 41 @Provide videoLandScape?: number = 1; // 视频朝向, 横屏视频:1;竖屏视频:2
42 42
43 - playVMChanged(name: string) { 43 + playVMChanged() {
44 this.url = this.playVM.url 44 this.url = this.playVM.url
45 this.newsSourceName = this.playVM.newsSourceName 45 this.newsSourceName = this.playVM.newsSourceName
46 this.newsTitle = this.playVM.newsTitle 46 this.newsTitle = this.playVM.newsTitle
@@ -98,7 +98,7 @@ export struct DetailPlayShortVideoPage { @@ -98,7 +98,7 @@ export struct DetailPlayShortVideoPage {
98 WDPlayerRenderView({ 98 WDPlayerRenderView({
99 playerController: this.playerController, 99 playerController: this.playerController,
100 onLoad: async () => { 100 onLoad: async () => {
101 - console.log('onload==') 101 + console.log('onload==', this.contentId, this.relId, this.relType)
102 // this.playVM.playWithContentId(this.contentId ?? "846899373") 102 // this.playVM.playWithContentId(this.contentId ?? "846899373")
103 this.playVM.playWithIds(this.contentId ?? "846899373", 103 this.playVM.playWithIds(this.contentId ?? "846899373",
104 this.relId ?? "500000301942", this.relType ?? "1") 104 this.relId ?? "500000301942", this.relType ?? "1")
@@ -155,7 +155,7 @@ export struct DetailPlayShortVideoPage { @@ -155,7 +155,7 @@ export struct DetailPlayShortVideoPage {
155 this.playerController.continue = undefined; 155 this.playerController.continue = undefined;
156 } 156 }
157 157
158 - urlChanged(name: string) { 158 + urlChanged() {
159 if (this.url) { 159 if (this.url) {
160 console.log("url:" + this.url); 160 console.log("url:" + this.url);
161 this.status = PlayerConstants.STATUS_START; 161 this.status = PlayerConstants.STATUS_START;
@@ -90,57 +90,66 @@ export struct PlayerTitleComment { @@ -90,57 +90,66 @@ export struct PlayerTitleComment {
90 .width('100%') 90 .width('100%')
91 .alignItems(VerticalAlign.Bottom) 91 .alignItems(VerticalAlign.Bottom)
92 92
93 - Slider({  
94 - value: this.progressVal,  
95 - step: 1,  
96 - style: SliderStyle.OutSet  
97 - })  
98 - .blockColor(Color.White)  
99 - .trackColor($r('app.color.track_color'))  
100 - .selectedColor($r('app.color.index_tab_selected_font_color'))  
101 - .trackThickness(1)  
102 - .width('100%')  
103 - .onChange((value: number, mode: SliderChangeMode) => {  
104 - this.playerController?.setSeekTime(value, mode);  
105 - })  
106 -  
107 Row() { 93 Row() {
108 - Image($r('app.media.ic_back'))  
109 - .width(44)  
110 - .aspectRatio(1)  
111 - .padding(13)  
112 - .onClick(() => {  
113 - if (this.isFullScreen) {  
114 - if (deviceInfo.deviceType != "phone") {  
115 - WindowModel.shared.getWindowSize().then((size) => {  
116 - if (size.width > size.height) {  
117 - router.back(); 94 + Column() {
  95 + Slider({
  96 + value: this.progressVal,
  97 + step: 1,
  98 + style: SliderStyle.OutSet
  99 + })
  100 + .blockColor(Color.White)
  101 + .trackColor($r('app.color.track_color'))
  102 + .selectedColor($r('app.color.index_tab_selected_font_color'))
  103 + .trackThickness(1)
  104 + .width('100%')
  105 + .onChange((value: number, mode: SliderChangeMode) => {
  106 + this.playerController?.setSeekTime(value, mode);
  107 + })
  108 +
  109 + Row() {
  110 + Image($r('app.media.ic_back'))
  111 + .width(24)
  112 + .height(24)
  113 + .aspectRatio(1)
  114 + .onClick(() => {
  115 + if (this.isFullScreen) {
  116 + if (deviceInfo.deviceType != "phone") {
  117 + WindowModel.shared.getWindowSize().then((size) => {
  118 + if (size.width > size.height) {
  119 + router.back();
  120 + } else {
  121 + this.isFullScreen = !this.isFullScreen;
  122 + WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT);
  123 + devicePLSensorManager.devicePLSensorOn(window.Orientation.PORTRAIT);
  124 + }
  125 + })
118 } else { 126 } else {
119 this.isFullScreen = !this.isFullScreen; 127 this.isFullScreen = !this.isFullScreen;
120 WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT); 128 WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT);
121 devicePLSensorManager.devicePLSensorOn(window.Orientation.PORTRAIT); 129 devicePLSensorManager.devicePLSensorOn(window.Orientation.PORTRAIT);
122 } 130 }
123 - })  
124 - } else {  
125 - this.isFullScreen = !this.isFullScreen;  
126 - WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT);  
127 - devicePLSensorManager.devicePLSensorOn(window.Orientation.PORTRAIT);  
128 - }  
129 - } else {  
130 - router.back();  
131 - }  
132 - }) 131 + } else {
  132 + router.back();
  133 + }
  134 + })
  135 +
  136 + TextInput({ placeholder: '说两句...', text: this.comment })
  137 +
  138 + .placeholderColor(Color.White)
  139 + .placeholderFont({ size: 14 })
  140 + .fontColor(Color.White)
  141 + .fontSize(14)
  142 + .maxLines(1)
  143 + .layoutWeight(1)
  144 + .backgroundColor('#1a1a1a')
  145 + .borderRadius(2)
  146 + .margin({ left: 12 })
  147 + }
  148 + .alignItems(VerticalAlign.Center)
  149 + .padding({ left: 16, right: 16, top: 11, bottom: 11 })
  150 + }
  151 + }.backgroundColor(Color.Black)
133 152
134 - TextInput({ placeholder: '说两句...', text: this.comment })  
135 - .placeholderColor(Color.White)  
136 - .placeholderFont({ size: 14 })  
137 - .fontColor(Color.White)  
138 - .fontSize(14)  
139 - .maxLines(1)  
140 - .layoutWeight(1)  
141 - .backgroundColor('#ccc')  
142 - .borderRadius(2)  
143 - }.alignItems(VerticalAlign.Center)  
144 } 153 }
145 .width('100%') 154 .width('100%')
146 // .height('40%') 155 // .height('40%')