This commit is contained in:
yumoqing 2024-10-10 16:28:33 +08:00
parent 66dc91a68b
commit 3594dd3161
2 changed files with 16 additions and 2 deletions

View File

@ -33,6 +33,9 @@ bricks.Signaling = class {
this.sessionhandlers = {};
this.init_websocket();
this.hb_task = null;
if (!this.heartbeat_period){
this.heartbeat_period = 0;
}
}
init_websocket(){
@ -125,12 +128,13 @@ bricks.Signaling = class {
return h
}
login(){
console.log('login send')
console.log('login send', this.heartbeat_period)
var d = {
type:'login',
}
this.send_data(d);
if (this.heartbeat_period){
if (this.heartbeat_period > 0){
console.log('call login again in', this.heartbeat_period, ' seconds');
this.hb_task = schedule_once(this.login.bind(this), this.heartbeat_period);
}
}

View File

@ -132,6 +132,16 @@ bricks.Video = class extends bricks.Layout {
}
}
set_source(url, vtype){
var t = url.toLowerCase();
if (t.endsWith('.m3u8')){
vtype = 'application/x-mpegURL';
} else if (t.endsWith('.mp4')){
vtype = 'video/mp4';
} else if (t.endsWith('.webm')){
vtype = 'video/webm';
} else {
vtype = 'application/x-mpegURL';
}
if(this.player){
this.video_body.cur_url = url;
this.video_body.cur_vtype = vtype;