This commit is contained in:
yumoqing 2024-10-10 13:44:28 +08:00
parent 18f9403d4e
commit 85d78372f0

View File

@ -38,6 +38,7 @@ bricks.Video = class extends bricks.Layout {
schedule_once(this.create_player.bind(this), 0.1); schedule_once(this.create_player.bind(this), 0.1);
this.hidedbtn = new bricks.Button({label:'click me'}); this.hidedbtn = new bricks.Button({label:'click me'});
this.hidedbtn.bind('click', this.play.bind(this)); this.hidedbtn.bind('click', this.play.bind(this));
this.hidedbtn.hide();
this.add_widget(this.hidedbtn); this.add_widget(this.hidedbtn);
} }
destroy_resource(params, event){ destroy_resource(params, event){
@ -59,15 +60,7 @@ 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(){
@ -76,10 +69,8 @@ bricks.Video = class extends bricks.Layout {
this.hidedbtn.dispatch('click'); this.hidedbtn.dispatch('click');
} }
play(){ play(){
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){