王士厅

fix: 沉浸式视频加载等待10s提示网络差逻辑优化

@@ -2,6 +2,7 @@ import { ContentDetailDTO } from 'wdBean/Index'; @@ -2,6 +2,7 @@ import { ContentDetailDTO } from 'wdBean/Index';
2 import { DateTimeUtils, ToastUtils } from 'wdKit/Index'; 2 import { DateTimeUtils, ToastUtils } from 'wdKit/Index';
3 import { PlayerConstants, WDPlayerController } from 'wdPlayer/Index'; 3 import { PlayerConstants, WDPlayerController } from 'wdPlayer/Index';
4 4
  5 +@Reusable
5 @Component 6 @Component
6 export struct PlayerProgressView { 7 export struct PlayerProgressView {
7 private playerController?: WDPlayerController; 8 private playerController?: WDPlayerController;
@@ -16,6 +17,7 @@ export struct PlayerProgressView { @@ -16,6 +17,7 @@ export struct PlayerProgressView {
16 @State showLoading: boolean = false 17 @State showLoading: boolean = false
17 @Consume onlyWifiLoadVideo: boolean 18 @Consume onlyWifiLoadVideo: boolean
18 timer: number = 0 19 timer: number = 0
  20 +
19 aboutToAppear() { 21 aboutToAppear() {
20 if (this.playerController) { 22 if (this.playerController) {
21 this.playerController.onSeekDone = (status: number) => { 23 this.playerController.onSeekDone = (status: number) => {
@@ -28,10 +30,12 @@ export struct PlayerProgressView { @@ -28,10 +30,12 @@ export struct PlayerProgressView {
28 if (this.onlyWifiLoadVideo) { 30 if (this.onlyWifiLoadVideo) {
29 this.showLoading = true 31 this.showLoading = true
30 } 32 }
  33 + // console.log("PlayerProgressView11", this.timer)
  34 + if(this.timer) {
  35 + clearTimeout(this.timer)
  36 + }
31 this.timer = setTimeout(() => { 37 this.timer = setTimeout(() => {
32 - if (this.playerController?.getPlayer()) {  
33 - ToastUtils.shortToast('网络出小差了,请检查下网络')  
34 - } 38 + ToastUtils.shortToast('网络出小差了,请检查下网络')
35 }, 10000) 39 }, 10000)
36 } else { 40 } else {
37 clearTimeout(this.timer) 41 clearTimeout(this.timer)