bugfix
This commit is contained in:
parent
359f177de6
commit
15879271ce
@ -63,15 +63,32 @@ bricks.Video = class extends bricks.Layout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
findVideoButtonByClass(cls){
|
||||||
|
var e = this.dom_element;
|
||||||
|
return e.querySelector('.' + cls);
|
||||||
|
}
|
||||||
|
|
||||||
auto_play(){
|
auto_play(){
|
||||||
return;
|
return;
|
||||||
schedule_once(this._auto_play.bind(this), 0.5);
|
schedule_once(this._auto_play.bind(this), 0.8);
|
||||||
}
|
}
|
||||||
_auto_play(){
|
_auto_play(){
|
||||||
|
var play_btn = this.findVideoButtonByClass('vjs-big-play-button');
|
||||||
|
if (!play_btn){
|
||||||
|
console.log('vjs-big-play-button not found');
|
||||||
|
return;
|
||||||
|
}
|
||||||
console.log('video ready, auto_playing ....');
|
console.log('video ready, auto_playing ....');
|
||||||
schedule_once(this.disable_captions.bind(this), 2);
|
var clickevent = new MouseEvent('click', {
|
||||||
this.hidedbtn.dispatch('click');
|
'bubbles': true, // 事件是否冒泡
|
||||||
|
'cancelable': true // 事件是否可取消
|
||||||
|
});
|
||||||
|
play_btn.dispatchEvent(clickevent);
|
||||||
|
if (this.autounmute && this.player.muted){
|
||||||
|
schedule_once(this.dispatch_mute.bind(this), 0.8);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
play(){
|
play(){
|
||||||
console.log('Video:play() called....');
|
console.log('Video:play() called....');
|
||||||
this.player.play();
|
this.player.play();
|
||||||
@ -92,17 +109,19 @@ bricks.Video = class extends bricks.Layout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dispatch_mute(){
|
dispatch_mute(){
|
||||||
var e = this.video_body.dom_element;
|
var mute_btn = this.findVideoButtonByClass("vjs-mute-control");
|
||||||
var mute_btn = e.querySelector(".vjs-mute-control");
|
|
||||||
if (!mute_btn){
|
if (!mute_btn){
|
||||||
console.log('there is not mute button found')
|
bricks.test_element = e;
|
||||||
|
console.log(e, 'there is not mute button found')
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var clickevent = new MouseEvent('click', {
|
var clickevent = new MouseEvent('click', {
|
||||||
'bubbles': true, // 事件是否冒泡
|
'bubbles': true, // 事件是否冒泡
|
||||||
'cancelable': true // 事件是否可取消
|
'cancelable': true // 事件是否可取消
|
||||||
});
|
});
|
||||||
mute_btn.dispatchEvent(clickEvent);
|
if (this.player.muted && this.autounmute){
|
||||||
|
mute_btn.dispatchEvent(clickevent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
create_player(){
|
create_player(){
|
||||||
@ -139,6 +158,12 @@ 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){
|
||||||
|
schedule_once(this.dispatch_mute.bind(this), 1);
|
||||||
|
console.log('mute btn clicked');
|
||||||
|
} else {
|
||||||
|
console.log(this.autounmute, 'player.muted=', this.player.muted);
|
||||||
|
}
|
||||||
this.dispatch('play_ok', {src:this.video_body.cur_url,type:this.video_body.cur_vtype});
|
this.dispatch('play_ok', {src:this.video_body.cur_url,type:this.video_body.cur_vtype});
|
||||||
}
|
}
|
||||||
report_error(){
|
report_error(){
|
||||||
@ -208,6 +233,7 @@ bricks.Iptv = class extends bricks.VBox {
|
|||||||
console.log('this.user_data =', this.user_data);
|
console.log('this.user_data =', this.user_data);
|
||||||
this.video = new bricks.Video({
|
this.video = new bricks.Video({
|
||||||
autoplay:true,
|
autoplay:true,
|
||||||
|
autounmute:this.autounmute,
|
||||||
url:this.user_data.url
|
url:this.user_data.url
|
||||||
});
|
});
|
||||||
this.title_w = new bricks.Text({text:this.user_data.tv_name, wrap:false});
|
this.title_w = new bricks.Text({text:this.user_data.tv_name, wrap:false});
|
||||||
|
Loading…
Reference in New Issue
Block a user