This commit is contained in:
yumoqing 2024-10-10 11:17:42 +08:00
parent 938b6fa850
commit 9ee30fc3ea

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({text:'click me'}); this.hidedbtn = new bricks.Button({text:'click me'});
this.hidedbtn.hide(); this.hidedbtn.hide();
this.hidedbtn.bind('click', this.play.bind(this));
this.add_widget(this.hidedbtn); this.add_widget(this.hidedbtn);
} }
destroy_resource(params, event){ destroy_resource(params, event){
@ -60,6 +61,7 @@ bricks.Video = class extends bricks.Layout {
} }
} }
auto_play(){ auto_play(){
console.log('video ready, auto_playing ....');
schedule_once(this.disable_captions.bind(this), 2); schedule_once(this.disable_captions.bind(this), 2);
this.player.on('error',this.report_error.bind(this)); this.player.on('error',this.report_error.bind(this));
this.player.on('play', this.report_playok.bind(this)); this.player.on('play', this.report_playok.bind(this));
@ -67,6 +69,7 @@ bricks.Video = class extends bricks.Layout {
this.hidedbtn.dispatch('click'); this.hidedbtn.dispatch('click');
} }
play(){ play(){
console.log('Video:play() called....');
this.player.play(); this.player.play();
} }
create_player(){ create_player(){