王士厅

fix: 进入视频详情,点击全屏按钮,进入全屏,拖动精度条。拖动的数和底部的精度不一样

@@ -10,13 +10,15 @@ import { window } from '@kit.ArkUI' @@ -10,13 +10,15 @@ import { window } from '@kit.ArkUI'
10 export struct PlayerFullScreenView { 10 export struct PlayerFullScreenView {
11 private playerController?: WDPlayerController; 11 private playerController?: WDPlayerController;
12 @Consume contentDetailData: ContentDetailDTO 12 @Consume contentDetailData: ContentDetailDTO
13 - @Consume progressVal: number; 13 + @Consume @Watch("updateProgress") progressVal: number;
14 @Consume status: number 14 @Consume status: number
15 @Consume displayDirection: DisplayDirection 15 @Consume displayDirection: DisplayDirection
16 @Consume isDragging: boolean 16 @Consume isDragging: boolean
17 @State videoDuration: number = this.contentDetailData?.videoInfo?.[0]?.videoDuration || 1 17 @State videoDuration: number = this.contentDetailData?.videoInfo?.[0]?.videoDuration || 1
18 @State showOperator: boolean = true 18 @State showOperator: boolean = true
19 private timer: number = -1 19 private timer: number = -1
  20 + @State upProVal: string = ''
  21 + @State duration: string = DateTimeUtils.secondToTime(this.videoDuration)
20 22
21 getTitle() { 23 getTitle() {
22 return this.contentDetailData?.newsTitle 24 return this.contentDetailData?.newsTitle
@@ -27,11 +29,17 @@ export struct PlayerFullScreenView { @@ -27,11 +29,17 @@ export struct PlayerFullScreenView {
27 WDShare.shareContent(this.contentDetailData) 29 WDShare.shareContent(this.contentDetailData)
28 } 30 }
29 31
  32 + updateProgress() {
  33 + this.upProVal = DateTimeUtils.secondToTime(Math.floor((this.progressVal / 100 * this.videoDuration)))
  34 + }
  35 +
30 aboutToAppear(): void { 36 aboutToAppear(): void {
31 WindowModel.shared.setWindowSystemBarEnable([]) 37 WindowModel.shared.setWindowSystemBarEnable([])
32 this.timer = setInterval(() => { 38 this.timer = setInterval(() => {
33 this.showOperator = false 39 this.showOperator = false
34 }, 5000) 40 }, 5000)
  41 + // 初始显示
  42 + this.updateProgress()
35 } 43 }
36 44
37 aboutToDisappear(): void { 45 aboutToDisappear(): void {
@@ -108,14 +116,15 @@ export struct PlayerFullScreenView { @@ -108,14 +116,15 @@ export struct PlayerFullScreenView {
108 }) 116 })
109 } 117 }
110 118
  119 +
111 @Builder 120 @Builder
112 bottomBuilder() { 121 bottomBuilder() {
113 122
114 Column() { 123 Column() {
115 Text() { 124 Text() {
116 - Span(DateTimeUtils.secondToTime(Math.floor(this.progressVal / 100 * this.videoDuration))) 125 + Span(this.upProVal)
117 Span(' / ') 126 Span(' / ')
118 - Span(DateTimeUtils.secondToTime(this.videoDuration)) 127 + Span(this.duration)
119 } 128 }
120 .fontSize(24) 129 .fontSize(24)
121 .fontColor(Color.White) 130 .fontColor(Color.White)
@@ -135,7 +144,7 @@ export struct PlayerFullScreenView { @@ -135,7 +144,7 @@ export struct PlayerFullScreenView {
135 this.playerController?.switchPlayOrPause() 144 this.playerController?.switchPlayOrPause()
136 }) 145 })
137 146
138 - Text(DateTimeUtils.secondToTime(Math.ceil((this.progressVal / 100 * this.videoDuration)))) 147 + Text(this.upProVal)
139 .fontSize(12) 148 .fontSize(12)
140 .fontWeight(600) 149 .fontWeight(600)
141 .fontColor(Color.White) 150 .fontColor(Color.White)
@@ -153,7 +162,7 @@ export struct PlayerFullScreenView { @@ -153,7 +162,7 @@ export struct PlayerFullScreenView {
153 } 162 }
154 }) 163 })
155 164
156 - Text(DateTimeUtils.secondToTime(this.videoDuration)) 165 + Text(this.duration)
157 .fontSize(12) 166 .fontSize(12)
158 .fontWeight(600) 167 .fontWeight(600)
159 .fontColor(Color.White) 168 .fontColor(Color.White)