王士厅

fix: 横屏视频左侧上下滑动调节屏幕亮度,右侧上下滑动调节音量逻辑优化

... ... @@ -18,6 +18,7 @@ export struct PlayerFullScreenView {
@State videoDuration: number = this.contentDetailData?.videoInfo?.[0]?.videoDuration || 1
@State showOperator: boolean = true
private timer: number = -1
private debounceTimer: number = -1
@State upProVal: string = ''
@State duration: string = DateTimeUtils.secondToTime(this.videoDuration)
@State startX: number = 0
... ... @@ -80,6 +81,13 @@ export struct PlayerFullScreenView {
}, 5000)
}
debounce(func: () => void, wait: number) {
if (this.debounceTimer) {
clearTimeout(this.debounceTimer);
}
this.debounceTimer = setTimeout(func, wait);
}
build() {
Stack({ alignContent: Alignment.Center }) {
Row() {
... ... @@ -121,7 +129,7 @@ export struct PlayerFullScreenView {
.gesture(
PanGesture(this.panOptionBright)
.onActionStart((event?: GestureEvent) => {
console.log(TAG, 'onActionEnd this.panOptionBright')
// console.log(TAG, 'onActionEnd this.panOptionBright')
this.isShowBright = true
this.playerController?.onBrightActionStart(event!);
})
... ... @@ -129,9 +137,9 @@ export struct PlayerFullScreenView {
this.playerController?.onBrightActionUpdate(event!);
})
.onActionEnd(() => {
setTimeout(() => {
this.isShowBright = false
}, 500)
this.debounce(() => {
this.isShowBright = false;
}, 1000);
this.playerController?.onActionEnd();
})
)
... ... @@ -154,9 +162,9 @@ export struct PlayerFullScreenView {
this.playerController?.onVolumeActionUpdate(event!);
})
.onActionEnd(() => {
setTimeout(() => {
this.isShowVolume = false
}, 500)
this.debounce(() => {
this.isShowVolume = false;
}, 1000);
this.playerController?.onActionEnd();
})
)
... ...