chenjun

视频全屏时,支持横向滑动手势调整进度,功能未实现

@@ -2,7 +2,7 @@ import { ContentDetailDTO } from 'wdBean/Index' @@ -2,7 +2,7 @@ import { ContentDetailDTO } from 'wdBean/Index'
2 import { WDShare } from 'wdShare/Index' 2 import { WDShare } from 'wdShare/Index'
3 import { PlayerProgressFullScreenView } from './PlayerProgressFullScreenView' 3 import { PlayerProgressFullScreenView } from './PlayerProgressFullScreenView'
4 import { PlayerConstants, WDPlayerController } from 'wdPlayer/Index' 4 import { PlayerConstants, WDPlayerController } from 'wdPlayer/Index'
5 -import { DateTimeUtils, WindowModel } from 'wdKit/Index' 5 +import { DateTimeUtils, Logger, WindowModel } from 'wdKit/Index'
6 import { DisplayDirection } from 'wdConstant/Index' 6 import { DisplayDirection } from 'wdConstant/Index'
7 import { window } from '@kit.ArkUI' 7 import { window } from '@kit.ArkUI'
8 8
@@ -64,7 +64,7 @@ export struct PlayerFullScreenView { @@ -64,7 +64,7 @@ export struct PlayerFullScreenView {
64 }) 64 })
65 65
66 this.headerBuilder() 66 this.headerBuilder()
67 - 67 + this.middleSlideBuilder()
68 this.bottomBuilder() 68 this.bottomBuilder()
69 } 69 }
70 .zIndex(99999) 70 .zIndex(99999)
@@ -187,4 +187,45 @@ export struct PlayerFullScreenView { @@ -187,4 +187,45 @@ export struct PlayerFullScreenView {
187 }) 187 })
188 188
189 } 189 }
  190 +
  191 + @Builder
  192 + middleSlideBuilder() {
  193 + Column() {
  194 + Slider({
  195 + value: this.progressVal,
  196 + step: 0.01,
  197 + style: SliderStyle.OutSet
  198 + })
  199 + .trackColor(Color.Transparent)// 设置轨道为透明
  200 + .selectedColor(Color.Transparent)// 设置已选择部分为透明
  201 + .blockColor(Color.Transparent)// 设置滑块为透明
  202 + .trackThickness(4)
  203 + .showSteps(false)// 不显示步进刻度
  204 + .showTips(false)// 不显示提示
  205 + .width('100%')
  206 + .height('100%')
  207 + .onChange((value: number, mode: SliderChangeMode) => {
  208 + this.progressVal = value
  209 + if (mode === SliderChangeMode.Moving) {
  210 + this.isDragging = true
  211 + }
  212 + if (mode === SliderChangeMode.End) {
  213 + this.isDragging = false
  214 + }
  215 +
  216 + console.log('Transparent slider value:', value)
  217 + })
  218 + }.margin({ top: 73, bottom: 73 })
  219 + .onTouch((event?: TouchEvent) => {
  220 + if (event) {
  221 + if (event.type === TouchType.Down) {
  222 + clearInterval(this.timer)
  223 + }
  224 + if (event.type === TouchType.Up) {
  225 + this.restartTimer();
  226 + this.playerController?.setSeekTime(this.progressVal, SliderChangeMode.End);
  227 + }
  228 + }
  229 + })
  230 + }
190 } 231 }