This commit is contained in:
yumoqing 2025-02-05 10:50:05 +08:00
parent 15879271ce
commit 6e2b8075c9

View File

@ -69,7 +69,6 @@ bricks.Video = class extends bricks.Layout {
} }
auto_play(){ auto_play(){
return;
schedule_once(this._auto_play.bind(this), 0.8); schedule_once(this._auto_play.bind(this), 0.8);
} }
_auto_play(){ _auto_play(){
@ -78,15 +77,21 @@ bricks.Video = class extends bricks.Layout {
console.log('vjs-big-play-button not found'); console.log('vjs-big-play-button not found');
return; return;
} }
if (play_btn.style.display == 'none'){
console.log('playing .............already');
return;
}
console.log('video ready, auto_playing ....'); console.log('video ready, auto_playing ....');
var clickevent = new MouseEvent('click', { var clickevent = new MouseEvent('click', {
'bubbles': true, // 事件是否冒泡 'bubbles': true, // 事件是否冒泡
'cancelable': true // 事件是否可取消 'cancelable': true // 事件是否可取消
}); });
play_btn.dispatchEvent(clickevent); play_btn.dispatchEvent(clickevent);
/*
if (this.autounmute && this.player.muted){ if (this.autounmute && this.player.muted){
schedule_once(this.dispatch_mute.bind(this), 0.8); schedule_once(this.dispatch_mute.bind(this), 1);
} }
*/
} }
play(){ play(){
@ -159,7 +164,7 @@ bricks.Video = class extends bricks.Layout {
this.play_status = 'playok'; this.play_status = 'playok';
console.log(this.video_body.cur_url, 'play ok'); console.log(this.video_body.cur_url, 'play ok');
if (this.autounmute && this.player.muted){ if (this.autounmute && this.player.muted){
schedule_once(this.dispatch_mute.bind(this), 1); schedule_once(this.dispatch_mute.bind(this), 1.5);
console.log('mute btn clicked'); console.log('mute btn clicked');
} else { } else {
console.log(this.autounmute, 'player.muted=', this.player.muted); console.log(this.autounmute, 'player.muted=', this.player.muted);