Merge branch 'development' into LTS_development
This commit is contained in:
commit
22188a7e4e
6 changed files with 36 additions and 4 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1022,9 +1022,21 @@ function MistVideo(streamName,options) {
|
||||||
socket.die = false;
|
socket.die = false;
|
||||||
socket.destroy = function(){
|
socket.destroy = function(){
|
||||||
this.die = true;
|
this.die = true;
|
||||||
|
if (MistVideo.reporting) {
|
||||||
|
MistVideo.reporting.reportStats();
|
||||||
|
MistVideo.reporting = false;
|
||||||
|
}
|
||||||
this.onclose = function(){};
|
this.onclose = function(){};
|
||||||
this.close();
|
this.close();
|
||||||
};
|
};
|
||||||
|
//add a timeout: if the websocket does not connect, switch to http polling
|
||||||
|
socket.timeOut = MistVideo.timers.start(function(){
|
||||||
|
if (socket.readyState <= 1) {
|
||||||
|
//either it hasn't opened yet, or it is open but we've not received a message so this timer hasn't been removed yet
|
||||||
|
socket.destroy();
|
||||||
|
openWithGet();
|
||||||
|
}
|
||||||
|
},5e3);
|
||||||
socket.onopen = function(e){
|
socket.onopen = function(e){
|
||||||
this.wasConnected = true;
|
this.wasConnected = true;
|
||||||
|
|
||||||
|
@ -1096,7 +1108,7 @@ function MistVideo(streamName,options) {
|
||||||
this.report(d);
|
this.report(d);
|
||||||
}
|
}
|
||||||
MistVideo.timers.start(function(){
|
MistVideo.timers.start(function(){
|
||||||
MistVideo.reporting.reportStats();
|
if (MistVideo.reporting) { MistVideo.reporting.reportStats(); }
|
||||||
},5e3);
|
},5e3);
|
||||||
},
|
},
|
||||||
init: function(){
|
init: function(){
|
||||||
|
@ -1224,6 +1236,11 @@ function MistVideo(streamName,options) {
|
||||||
var on_ended_show_state = false;
|
var on_ended_show_state = false;
|
||||||
var on_waiting_show_state = false;
|
var on_waiting_show_state = false;
|
||||||
socket.addEventListener("message",function(e){
|
socket.addEventListener("message",function(e){
|
||||||
|
if (socket.timeOut) {
|
||||||
|
MistVideo.timers.stop(socket.timeOut);
|
||||||
|
socket.timeOut = false;
|
||||||
|
}
|
||||||
|
|
||||||
var data = JSON.parse(e.data);
|
var data = JSON.parse(e.data);
|
||||||
if (!data) { MistVideo.showError("Error while parsing stream status stream. Obtained: "+e.data.toString(),{reload:true}); }
|
if (!data) { MistVideo.showError("Error while parsing stream status stream. Obtained: "+e.data.toString(),{reload:true}); }
|
||||||
|
|
||||||
|
|
|
@ -406,6 +406,13 @@ p.prototype.build = function (MistVideo,callback) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
this.ws.timeOut = MistVideo.timers.start(function(){
|
||||||
|
if (player.ws.readyState == 0) {
|
||||||
|
MistVideo.log("MP4 over WS: socket timeout - try next combo");
|
||||||
|
MistVideo.nextCombo();
|
||||||
|
}
|
||||||
|
},5e3);
|
||||||
|
|
||||||
this.ws.listeners = {}; //kind of event listener list for websocket messages
|
this.ws.listeners = {}; //kind of event listener list for websocket messages
|
||||||
this.ws.addListener = function(type,f){
|
this.ws.addListener = function(type,f){
|
||||||
if (!(type in this.listeners)) { this.listeners[type] = []; }
|
if (!(type in this.listeners)) { this.listeners[type] = []; }
|
||||||
|
|
|
@ -435,6 +435,14 @@ p.prototype.build = function (MistVideo,callback) {
|
||||||
this.ws.onopen = function() {
|
this.ws.onopen = function() {
|
||||||
onEvent({type: "on_connected"});
|
onEvent({type: "on_connected"});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.ws.timeOut = MistVideo.timers.start(function(){
|
||||||
|
if (MistVideo.player.webrtc.signaling.ws.readyState == 0) {
|
||||||
|
MistVideo.log("WebRTC: socket timeout - try next combo");
|
||||||
|
MistVideo.nextCombo();
|
||||||
|
}
|
||||||
|
},5e3);
|
||||||
|
|
||||||
|
|
||||||
this.ws.onmessage = function(e) {
|
this.ws.onmessage = function(e) {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Reference in a new issue