王士厅

fix: 加载场景-进度加载_视频加载>加载中切断网络页面报错

import { ContentDetailDTO } from 'wdBean/Index';
import { DateTimeUtils } from 'wdKit/Index';
import { DateTimeUtils, ToastUtils } from 'wdKit/Index';
import { PlayerConstants, WDPlayerController } from 'wdPlayer/Index';
@Component
... ... @@ -15,6 +15,7 @@ export struct PlayerProgressView {
@State loadingWidth: number | string = 1
@State showLoading: boolean = false
@Consume onlyWifiLoadVideo: boolean
timer: number = 0
aboutToAppear() {
if (this.playerController) {
this.playerController.onSeekDone = (status: number) => {
... ... @@ -27,7 +28,11 @@ export struct PlayerProgressView {
if (this.onlyWifiLoadVideo) {
this.showLoading = true
}
this.timer = setTimeout(() => {
ToastUtils.shortToast('网络出小差了,请检查下网络')
}, 10000)
} else {
clearTimeout(this.timer)
this.loadingWidth = 1
this.showLoading = false
}
... ...
... ... @@ -156,7 +156,7 @@ export class WDPlayerController {
this.initProgress(time);
});
this.avPlayer?.on(Events.ERROR, (error) => {
this.playError(error.message);
// this.playError(error.message);
Logger.error(TAG, '播放错误' + JSON.stringify(error))
TrackingPlay.videoPlayError(error.message, this.pageName, this.pageName, this.pageParam)
})
... ... @@ -448,20 +448,20 @@ export class WDPlayerController {
Logger.debug(TAG, 'watchStatus ' + this.status)
if(this.status == PlayerConstants.STATUS_START){
Logger.debug(TAG, '播放视频')
Logger.debug(TAG, '播放视频prepareTime' + JSON.stringify(this.prepareTime))
Logger.debug(TAG, '播放视频pageName' + JSON.stringify(this.pageName))
Logger.debug(TAG, '播放视频pageParam' + JSON.stringify(this.pageParam))
// Logger.debug(TAG, '播放视频')
// Logger.debug(TAG, '播放视频prepareTime' + JSON.stringify(this.prepareTime))
// Logger.debug(TAG, '播放视频pageName' + JSON.stringify(this.pageName))
// Logger.debug(TAG, '播放视频pageParam' + JSON.stringify(this.pageParam))
// 播放埋点
TrackingPlay.videoPositivePlay(Number(this.prepareTime),this.pageName, this.pageName, this.pageParam)
}
if(this.status == PlayerConstants.STATUS_COMPLETION){
let initDuration = Math.floor(Number(this.duration)/1000)
Logger.debug(TAG, '播放结束')
Logger.debug(TAG, '播放结束currentPlayTime' + JSON.stringify(this.currentPlayTime))
Logger.debug(TAG, '播放结束initDuration' + JSON.stringify(initDuration))
Logger.debug(TAG, '播放结束pageName' + JSON.stringify(this.pageName))
Logger.debug(TAG, '播放结束pageParam' + JSON.stringify(this.pageParam))
// Logger.debug(TAG, '播放结束')
// Logger.debug(TAG, '播放结束currentPlayTime' + JSON.stringify(this.currentPlayTime))
// Logger.debug(TAG, '播放结束initDuration' + JSON.stringify(initDuration))
// Logger.debug(TAG, '播放结束pageName' + JSON.stringify(this.pageName))
// Logger.debug(TAG, '播放结束pageParam' + JSON.stringify(this.pageParam))
// 播放结束埋点
TrackingPlay.videoPlayEnd(this.currentPlayTime, initDuration, this.currentPlayTime, this.pageName, this.pageName, this.pageParam)
}
... ...