fix bug
This commit is contained in:
@@ -96,7 +96,7 @@ export class PreloadUI extends Component {
|
||||
this.desc = this._nodeTab.Desc.getComponent(Label);
|
||||
|
||||
// 设置视频为静音,提高移动端自动播放成功率
|
||||
this.VideoPlayer.muted = true;
|
||||
this.VideoPlayer.mute = true;
|
||||
this.VideoPlayer.loop = true;
|
||||
this.VideoPlayer.stayOnBottom = true;
|
||||
|
||||
@@ -205,16 +205,25 @@ export class PreloadUI extends Component {
|
||||
// 尝试播放视频
|
||||
try {
|
||||
this.VideoPlayer.play();
|
||||
logger.log(`PreloadUI: Video play attempted (retry: ${this.videoPlayRetryCount}/${this.maxVideoPlayRetry})`);
|
||||
logger.log(
|
||||
`PreloadUI: Video play attempted (retry: ${this.videoPlayRetryCount}/${this.maxVideoPlayRetry})`
|
||||
);
|
||||
|
||||
// 延迟检查播放状态,如果失败则重试
|
||||
this.scheduleOnce(() => {
|
||||
if (!this.VideoPlayer.isPlaying && this.videoPlayRetryCount < this.maxVideoPlayRetry) {
|
||||
if (
|
||||
!this.VideoPlayer.isPlaying &&
|
||||
this.videoPlayRetryCount < this.maxVideoPlayRetry
|
||||
) {
|
||||
this.videoPlayRetryCount++;
|
||||
logger.warn(`PreloadUI: Video play failed, retrying... (${this.videoPlayRetryCount}/${this.maxVideoPlayRetry})`);
|
||||
logger.warn(
|
||||
`PreloadUI: Video play failed, retrying... (${this.videoPlayRetryCount}/${this.maxVideoPlayRetry})`
|
||||
);
|
||||
this.tryPlayVideo();
|
||||
} else if (!this.VideoPlayer.isPlaying) {
|
||||
logger.warn("PreloadUI: Video autoplay failed after max retries. Will retry on user interaction.");
|
||||
logger.warn(
|
||||
"PreloadUI: Video autoplay failed after max retries. Will retry on user interaction."
|
||||
);
|
||||
}
|
||||
}, 0.5);
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user