Embed: - fixed timer issue causing player to reload after an unload
- added version numbering
This commit is contained in:
parent
27b85e76d3
commit
b6486878ca
13 changed files with 38 additions and 11 deletions
|
@ -42,7 +42,7 @@ MistPlayer.prototype.build = function () {
|
|||
}
|
||||
MistPlayer.prototype.timer = {
|
||||
timers: {},
|
||||
add: function(callback,delay){
|
||||
add: function(callback,delay,isInterval){
|
||||
var me = this;
|
||||
var i = setTimeout(function(){
|
||||
delete me.timers[i];
|
||||
|
@ -50,19 +50,24 @@ MistPlayer.prototype.timer = {
|
|||
},delay);
|
||||
this.timers[i] = {
|
||||
delay: delay,
|
||||
callback: callback
|
||||
callback: callback,
|
||||
interval: isInterval || false
|
||||
};
|
||||
return i;
|
||||
},
|
||||
remove: function(i){
|
||||
clearTimeout(i);
|
||||
if (this.timers[i].interval) {
|
||||
clearInterval(i);
|
||||
}
|
||||
else {
|
||||
clearTimeout(i);
|
||||
}
|
||||
delete this.timers[i];
|
||||
},
|
||||
clear: function(){
|
||||
for (var i in this.timers) {
|
||||
clearTimeout(i);
|
||||
this.remove(i);
|
||||
}
|
||||
this.timers = {};
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -688,6 +693,7 @@ MistPlayer.prototype.askNextCombo = function(msg){
|
|||
button.appendChild(t);
|
||||
err.appendChild(button);
|
||||
button.onclick = function(){
|
||||
me.addlog('Reloading player because the reload button was triggered');
|
||||
me.reload();
|
||||
}
|
||||
|
||||
|
@ -697,6 +703,7 @@ MistPlayer.prototype.askNextCombo = function(msg){
|
|||
type: 'playback',
|
||||
warn: 'Automatically reloaded the current player after playback error'
|
||||
});
|
||||
me.addlog('Triggering reload button because of timeout');
|
||||
button.click();
|
||||
},20e3);
|
||||
|
||||
|
@ -785,6 +792,7 @@ MistPlayer.prototype.unload = function(){
|
|||
}
|
||||
this.timer.clear();
|
||||
this.target.innerHTML = '';
|
||||
this.element.innerHTML = '';
|
||||
};
|
||||
|
||||
function mistCheck(streaminfo,options,embedLog) {
|
||||
|
@ -1244,7 +1252,7 @@ function mistPlay(streamName,options) {
|
|||
if ((!element.checkProgressTimeout) && (player.element) && ('currentTime' in player.element)) {
|
||||
//check if the progress made is equal to the time spent
|
||||
var lasttime = player.element.currentTime;
|
||||
element.checkProgressTimeout = setInterval(function(){
|
||||
element.checkProgressTimeout = player.timer.add(function(){
|
||||
var newtime = player.element.currentTime;
|
||||
var progress = newtime - lasttime;
|
||||
lasttime = newtime;
|
||||
|
@ -1279,13 +1287,13 @@ function mistPlay(streamName,options) {
|
|||
});
|
||||
return;
|
||||
}
|
||||
},30e3);
|
||||
},30e3,true);
|
||||
}
|
||||
},true);
|
||||
element.addEventListener('pause',function(){
|
||||
player.paused = true;
|
||||
if (element.checkProgressTimeout) {
|
||||
clearInterval(element.checkProgressTimeout);
|
||||
player.timer.remove(element.checkProgressTimeout);
|
||||
element.checkProgressTimeout = false;
|
||||
}
|
||||
},true);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
mistplayers.dashjs = {
|
||||
name: 'Dash.js Player',
|
||||
version: '1.1',
|
||||
mimes: ['dash/video/mp4'],
|
||||
priority: Object.keys(mistplayers).length + 1,
|
||||
isMimeSupported: function (mimetype) {
|
||||
|
@ -131,3 +132,11 @@ p.prototype.resize = function(size){
|
|||
this.element.width = size.width;
|
||||
this.element.height = size.height;
|
||||
};
|
||||
p.prototype.updateSrc = function(src){
|
||||
if (src == '') {
|
||||
this.dash.reset();
|
||||
return;
|
||||
}
|
||||
this.dash.attachSource(src);
|
||||
return true;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
mistplayers.flash_strobe = {
|
||||
name: 'Strobe Flash Media Playback',
|
||||
version: '1.0',
|
||||
mimes: ['flash/10','flash/11','flash/7'],
|
||||
priority: Object.keys(mistplayers).length + 1,
|
||||
isMimeSupported: function (mimetype) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
mistplayers.html5 = {
|
||||
name: 'HTML5 video player',
|
||||
version: '1.0',
|
||||
mimes: ['html5/application/vnd.apple.mpegurl','html5/video/mp4','html5/video/ogg','html5/video/webm','html5/audio/mp3','html5/audio/webm','html5/audio/ogg','html5/audio/wav'],
|
||||
priority: Object.keys(mistplayers).length + 1,
|
||||
isMimeSupported: function (mimetype) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
mistplayers.img = {
|
||||
name: 'HTML img tag',
|
||||
version: '1.0',
|
||||
mimes: ['html5/image/jpeg'],
|
||||
priority: Object.keys(mistplayers).length + 1,
|
||||
isMimeSupported: function (mimetype) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
mistplayers.jwplayer = {
|
||||
name: 'JWPlayer',
|
||||
version: '0.1',
|
||||
mimes: ['html5/video/mp4','html5/video/webm','dash/video/mp4','flash/10','flash/7','html5/application/vnd.apple.mpegurl','html5/audio/mp3','html5/audio/aac'],
|
||||
priority: Object.keys(mistplayers).length + 1,
|
||||
isMimeSupported: function (mimetype) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
mistplayers.polytrope = {
|
||||
name: 'Polytrope Flash Player',
|
||||
version: '0.1',
|
||||
mimes: ['flash/11','flash/10','flash/7'],
|
||||
priority: Object.keys(mistplayers).length + 1,
|
||||
isMimeSupported: function (mimetype) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
mistplayers.silverlight = {
|
||||
name: 'Silverlight',
|
||||
version: '1.0',
|
||||
mimes: ['silverlight'],
|
||||
priority: Object.keys(mistplayers).length + 1,
|
||||
isMimeSupported: function (mimetype) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
mistplayers.myplayer = {
|
||||
name: 'My video player',
|
||||
version: '0.1',
|
||||
mimes: ['my/mime/types'],
|
||||
priority: Object.keys(mistplayers).length + 1,
|
||||
isMimeSupported: function (mimetype) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
mistplayers.theoplayer = {
|
||||
name: 'TheoPlayer',
|
||||
version: '0.1',
|
||||
mimes: ['html5/application/vnd.apple.mpegurl','dash/video/mp4'],
|
||||
priority: Object.keys(mistplayers).length + 1,
|
||||
isMimeSupported: function (mimetype) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
mistplayers.videojs = {
|
||||
name: 'VideoJS player',
|
||||
version: '1.0',
|
||||
mimes: ['html5/video/mp4','html5/application/vnd.apple.mpegurl','html5/video/ogg','html5/video/webm'],
|
||||
priority: Object.keys(mistplayers).length + 1,
|
||||
isMimeSupported: function (mimetype) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue