This commit is contained in:
yumoqing 2024-10-10 11:49:09 +08:00
parent 195a8de10e
commit dede41601a

View File

@ -59,7 +59,15 @@ bricks.Video = class extends bricks.Layout {
} }
} }
} }
set_muted(flg){
if (flg){
this.player.muted = true;
} else {
this.player.muted = false;
}
}
auto_play(){ auto_play(){
this.set_muted(true);
schedule_once(this._auto_play.bind(this), 0.5); schedule_once(this._auto_play.bind(this), 0.5);
} }
_auto_play(){ _auto_play(){
@ -74,16 +82,19 @@ bricks.Video = class extends bricks.Layout {
this.hidedbtn.hide(); this.hidedbtn.hide();
console.log('Video:play() called....'); console.log('Video:play() called....');
this.player.play(); this.player.play();
this.set_muted(false);
} }
create_player(){ create_player(){
if(this.url){ if(this.url){
this.player = videojs(this.video_body.dom_element, { this.player = videojs(this.video_body.dom_element, {
controls:true, controls:true,
autoplay:this.autoplay,
muted:true,
nativeTextTracks:false, nativeTextTracks:false,
textTrackSettings: false textTrackSettings: false
}); });
this._set_source(); this._set_source();
if (self.autoplay || self.auto_play){ if (self.autoplay){
this.player.ready(this.auto_play.bind(this)); this.player.ready(this.auto_play.bind(this));
} else { } else {
console.log('autoplay=', this.autoplay, this.auto_play); console.log('autoplay=', this.autoplay, this.auto_play);