diff --git a/embed/core.js b/embed/core.js
index 16a87052..d3d7265b 100644
--- a/embed/core.js
+++ b/embed/core.js
@@ -56,18 +56,21 @@ MistPlayer.prototype.timer = {
return i;
},
remove: function(i){
- if (this.timers[i].interval) {
- clearInterval(i);
+ if (i in this.timers) {
+ if (this.timers[i].interval) {
+ clearInterval(i);
+ }
+ else {
+ clearTimeout(i);
+ }
+ delete this.timers[i];
}
- else {
- clearTimeout(i);
- }
- delete this.timers[i];
},
clear: function(){
for (var i in this.timers) {
this.remove(i);
}
+ this.timers = {};
}
};
@@ -900,12 +903,17 @@ function mistPlay(streamName,options) {
err.innerHTML = displaymsg.replace(new RegExp("\n",'g'),'
')+'
';
err.className = 'error';
var button = document.createElement('button');
+ var i = document.createElement('div');
+ button.appendChild(i);
var t = document.createTextNode('Reload');
button.appendChild(t);
err.appendChild(button);
button.onclick = function(){
options.target.removeChild(err);
delete options.startCombo;
+ if (err.timeOut) {
+ clearTimeout(err.timeOut);
+ }
mistPlay(streamName,options);
}
@@ -913,6 +921,20 @@ function mistPlay(streamName,options) {
protoplay.sendEvent('error',msg,options.target);
+ if (!('type' in info) || (info.type != 'vod')) { //always show the button timer, unless its a vod
+ //reload timeout
+ var delay = ('type' in info ? 20 : 60);
+ i.className = 'countdown'+delay;
+ err.timeOut = protoplay.timer.add(function(){
+ protoplay.report({
+ type: 'playback',
+ warn: 'Automatically checking if the stream is working now'
+ });
+ embedLog('Triggering reload button because of timeout');
+ button.click();
+ },delay*1e3);
+ }
+
return err;
}
@@ -974,7 +996,7 @@ function mistPlay(streamName,options) {
function onstreaminfo() {
options.target.innerHTML = '';
options.target.removeAttribute('data-loading');
- embedLog('Stream info was loaded succesfully');
+ embedLog('Stream info was loaded succesfully.');
//get streaminfo data
var streaminfo = mistvideo[streamName];
@@ -982,12 +1004,22 @@ function mistPlay(streamName,options) {
streaminfo.initTime = new Date();
if (!('source' in streaminfo)) {
- mistError('Error while loading stream info.');
- protoplay.report({
- type: 'init',
- error: 'No sources'
- });
- return;
+ if ((streaminfo.type) && (streaminfo.type == 'live')) {
+ mistError('The live stream is currently offline.');
+ return;
+ }
+ else if ('error' in streaminfo) {
+ mistError(streaminfo.error);
+ return;
+ }
+ else {
+ mistError('Error while parsing stream info.');
+ protoplay.report({
+ type: 'init',
+ error: 'No sources'
+ });
+ return;
+ }
}
if (('forceType' in options) && (options.forceType)) {
diff --git a/embed/mist.css b/embed/mist.css
index a8793eaf..99364fc1 100644
--- a/embed/mist.css
+++ b/embed/mist.css
@@ -360,7 +360,7 @@
}
}
-.countdown {
+.countdown, .countdown20, .countdown60 {
height: 1em;
width: 1em;
display: inline-block;
@@ -372,7 +372,7 @@
opacity: 0;
animation: appear 20s step-start 1;
}
-.countdown:before {
+.countdown:before, .countdown20:before, .countdown60:before {
content: '';
display: block;
margin-left: 50%;
@@ -382,6 +382,12 @@
transform-origin: 0 50%;
animation: rotate 10s linear 2, bg 20s step-end 1;
}
+.countdown60 {
+ animation: appear 60s step-start 1;
+}
+.coutndown60:before {
+ animation: rotate 30s linear 2, bg 60s step-end 1;
+}
@keyframes rotate {
to { transform: rotate(.5turn); }
}