Meta player, new embed code, new LSP style
This commit is contained in:
parent
5501c67b49
commit
d4be01474d
50 changed files with 6288 additions and 970 deletions
100
embed/wrappers/dashjs.js
Normal file
100
embed/wrappers/dashjs.js
Normal file
|
@ -0,0 +1,100 @@
|
|||
mistplayers.dashjs = {
|
||||
name: 'Dash.js Player',
|
||||
mimes: ['dash/video/mp4'],
|
||||
priority: Object.keys(mistplayers).length + 1,
|
||||
isMimeSupported: function (mimetype) {
|
||||
return (this.mimes.indexOf(mimetype) == -1 ? false : true);
|
||||
},
|
||||
isBrowserSupported: function (mimetype) {
|
||||
return (('dashjs' in window) && ('MediaSource' in window) && (location.protocol != 'file:'));
|
||||
},
|
||||
player: function(){}
|
||||
};
|
||||
var p = mistplayers.dashjs.player;
|
||||
p.prototype = new MistPlayer();
|
||||
p.prototype.build = function (options,callback) {
|
||||
var cont = document.createElement('div');
|
||||
cont.className = 'mistplayer';
|
||||
var me = this;
|
||||
|
||||
var ele = this.element('video');
|
||||
ele.className = '';
|
||||
cont.appendChild(ele);
|
||||
ele.width = options.width;
|
||||
ele.height = options.height;
|
||||
|
||||
if (options.autoplay) {
|
||||
ele.setAttribute('autoplay','');
|
||||
}
|
||||
if (options.loop) {
|
||||
ele.setAttribute('loop','');
|
||||
}
|
||||
if (options.poster) {
|
||||
ele.setAttribute('poster',options.poster);
|
||||
}
|
||||
if (options.controls) {
|
||||
if (options.controls == 'stock') {
|
||||
ele.setAttribute('controls','');
|
||||
}
|
||||
else {
|
||||
this.buildMistControls();
|
||||
}
|
||||
}
|
||||
|
||||
ele.addEventListener('error',function(e){
|
||||
var n = {
|
||||
0: 'NETWORK_EMPTY',
|
||||
1: 'NETWORK_IDLE',
|
||||
2: 'NETWORK_LOADING',
|
||||
3: 'NETWORK_NO_SOURCE'
|
||||
}
|
||||
var r = {
|
||||
0: 'HAVE_NOTHING',
|
||||
1: 'HAVE_METADATA',
|
||||
2: 'HAVE_CURRENT_DATA',
|
||||
3: 'HAVE_FUTURE_DATA',
|
||||
4: 'HAVE_ENOUGH_DATA'
|
||||
};
|
||||
me.adderror("Player event fired: error\nnetworkState: "+n[this.networkState]+"\nreadyState: "+r[this.readyState]);
|
||||
},true);
|
||||
var events = ['abort','canplay','canplaythrough','durationchange','emptied','ended','interruptbegin','interruptend','loadeddata','loadedmetadata','loadstart','pause','play','playing','ratechange','seeked','seeking','stalled','volumechange','waiting'];
|
||||
for (var i in events) {
|
||||
ele.addEventListener(events[i],function(e){
|
||||
me.addlog('Player event fired: '+e.type);
|
||||
},true);
|
||||
}
|
||||
|
||||
var player = dashjs.MediaPlayer().create();
|
||||
player.getDebug().setLogToBrowserConsole(false);
|
||||
player.initialize(ele,options.src,true);
|
||||
this.dash = player;
|
||||
this.src = options.src;
|
||||
|
||||
this.addlog('Built html');
|
||||
return cont;
|
||||
}
|
||||
p.prototype.play = function(){ return this.element.play(); };
|
||||
p.prototype.pause = function(){ return this.element.pause(); };
|
||||
p.prototype.volume = function(level){
|
||||
if (typeof level == 'undefined' ) { return this.element.volume; }
|
||||
return this.element.volume = level;
|
||||
};
|
||||
p.prototype.play = function(){ return this.element.play(); };
|
||||
p.prototype.load = function(){ return this.element.load(); };
|
||||
if (document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled) {
|
||||
p.prototype.fullscreen = function(){
|
||||
if(this.element.requestFullscreen) {
|
||||
return this.element.requestFullscreen();
|
||||
} else if(this.element.mozRequestFullScreen) {
|
||||
return this.element.mozRequestFullScreen();
|
||||
} else if(this.element.webkitRequestFullscreen) {
|
||||
return this.element.webkitRequestFullscreen();
|
||||
} else if(this.element.msRequestFullscreen) {
|
||||
return this.element.msRequestFullscreen();
|
||||
}
|
||||
};
|
||||
}
|
||||
p.prototype.resize = function(size){
|
||||
this.element.width = size.width;
|
||||
this.element.height = size.height;
|
||||
};
|
62
embed/wrappers/flash_strobe.js
Normal file
62
embed/wrappers/flash_strobe.js
Normal file
|
@ -0,0 +1,62 @@
|
|||
mistplayers.flash_strobe = {
|
||||
name: 'Strobe Flash Media Playback',
|
||||
mimes: ['flash/11','flash/10','flash/7'],
|
||||
priority: Object.keys(mistplayers).length + 1,
|
||||
isMimeSupported: function (mimetype) {
|
||||
return (this.mimes.indexOf(mimetype) == -1 ? false : true);
|
||||
},
|
||||
isBrowserSupported: function (mimetype) {
|
||||
var version = 0;
|
||||
try {
|
||||
// check in the mimeTypes
|
||||
version = navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin.description.replace(/([^0-9\.])/g, '').split('.')[0];
|
||||
} catch(e){}
|
||||
try {
|
||||
// for our special friend IE
|
||||
version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable("$version").replace(/([^0-9\,])/g, '').split(',')[0];
|
||||
} catch(e){}
|
||||
|
||||
var mimesplit = mimetype.split('/');
|
||||
|
||||
return Number(version) >= Number(mimesplit[mimesplit.length-1]);
|
||||
},
|
||||
player: function(){}
|
||||
};
|
||||
var p = mistplayers.flash_strobe.player;
|
||||
p.prototype = new MistPlayer();
|
||||
p.prototype.build = function (options) {
|
||||
function createParam(name,value) {
|
||||
var p = document.createElement('param');
|
||||
p.setAttribute('name',name);
|
||||
p.setAttribute('value',value);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
var ele = this.element('object');
|
||||
|
||||
ele.setAttribute('width',options.width);
|
||||
ele.setAttribute('height',options.height);
|
||||
|
||||
ele.appendChild(createParam('movie',options.source.player_url));
|
||||
var flashvars = 'src='+encodeURIComponent(options.src)+'&controlBarMode='+(options.controls ? 'floating' : 'none')+'&initialBufferTime=0.5&expandedBufferTime=5&minContinuousPlaybackTime=3'+(options.live ? '&streamType=live' : '')+(options.autoplay ? '&autoPlay=true' : '' );
|
||||
ele.appendChild(createParam('flashvars',flashvars));
|
||||
ele.appendChild(createParam('allowFullScreen','true'));
|
||||
ele.appendChild(createParam('wmode','direct'));
|
||||
if (options.autoplay) {
|
||||
ele.appendChild(createParam('autoPlay','true'));
|
||||
}
|
||||
|
||||
var e = document.createElement('embed');
|
||||
ele.appendChild(e);
|
||||
e.setAttribute('src',options.source.player_url);
|
||||
e.setAttribute('type','application/x-shockwave-flash');
|
||||
e.setAttribute('allowfullscreen','true');
|
||||
e.setAttribute('width',options.width);
|
||||
e.setAttribute('height',options.height);
|
||||
e.setAttribute('flashvars',flashvars);
|
||||
|
||||
|
||||
this.addlog('Built html');
|
||||
return ele;
|
||||
}
|
240
embed/wrappers/html5.js
Normal file
240
embed/wrappers/html5.js
Normal file
|
@ -0,0 +1,240 @@
|
|||
mistplayers.html5 = {
|
||||
name: 'HTML5 video player',
|
||||
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) {
|
||||
return (this.mimes.indexOf(mimetype) == -1 ? false : true);
|
||||
},
|
||||
isBrowserSupported: function (mimetype) {
|
||||
if ((['iPad','iPhone','iPod','MacIntel'].indexOf(navigator.platform) != -1) && (mimetype == 'html5/video/mp4')) { return false; }
|
||||
var support = false;
|
||||
var shortmime = mimetype.split('/');
|
||||
shortmime.shift();
|
||||
try {
|
||||
var v = document.createElement((shortmime[0] == 'audio' ? 'audio' : 'video'));
|
||||
shortmime = shortmime.join('/')
|
||||
if ((v) && (v.canPlayType(shortmime) != "")) {
|
||||
support = v.canPlayType(shortmime);
|
||||
}
|
||||
} catch(e){}
|
||||
return support;
|
||||
},
|
||||
player: function(){},
|
||||
mistControls: true
|
||||
};
|
||||
var p = mistplayers.html5.player;
|
||||
p.prototype = new MistPlayer();
|
||||
p.prototype.build = function (options,callback) {
|
||||
var cont = document.createElement('div');
|
||||
cont.className = 'mistplayer';
|
||||
var me = this; //to allow nested functions to access the player class itself
|
||||
|
||||
var shortmime = options.source.type.split('/');
|
||||
shortmime.shift();
|
||||
|
||||
var ele = this.element((shortmime[0] == 'audio' ? 'audio' : 'video'));
|
||||
ele.className = '';
|
||||
cont.appendChild(ele);
|
||||
ele.crossOrigin = 'anonymous';
|
||||
if (shortmime[0] == 'audio') {
|
||||
this.setTracks = false;
|
||||
this.fullscreen = false;
|
||||
cont.className += ' audio';
|
||||
}
|
||||
|
||||
this.addlog('Building HTML5 player..');
|
||||
|
||||
var source = document.createElement('source');
|
||||
source.setAttribute('src',options.src);
|
||||
this.source = source;
|
||||
ele.appendChild(source);
|
||||
source.type = shortmime.join('/');
|
||||
this.addlog('Adding '+source.type+' source @ '+options.src);
|
||||
|
||||
if ((this.tracks.subtitle.length) && (this.subtitle)) {
|
||||
for (var i in this.tracks.subtitle) {
|
||||
var t = document.createElement('track');
|
||||
ele.appendChild(t);
|
||||
t.kind = 'subtitles';
|
||||
t.label = this.tracks.subtitle[i].desc;
|
||||
t.srclang = this.tracks.subtitle[i].lang;
|
||||
t.src = this.subtitle+'?track='+this.tracks.subtitle[i].trackid;
|
||||
}
|
||||
}
|
||||
|
||||
ele.width = options.width;
|
||||
ele.height = options.height;
|
||||
ele.style.width = options.width+'px';
|
||||
ele.style.height = options.height+'px';
|
||||
ele.startTime = 0;
|
||||
|
||||
if (options.autoplay) {
|
||||
ele.setAttribute('autoplay','');
|
||||
}
|
||||
if (options.loop) {
|
||||
ele.setAttribute('loop','');
|
||||
}
|
||||
if (options.poster) {
|
||||
ele.setAttribute('poster',options.poster);
|
||||
}
|
||||
if (options.controls) {
|
||||
if ((options.controls == 'stock') || (!this.buildMistControls())) {
|
||||
//MistControls have failed to build in the if condition
|
||||
ele.setAttribute('controls','');
|
||||
}
|
||||
}
|
||||
|
||||
cont.onclick = function(){
|
||||
if (ele.paused) { ele.play(); }
|
||||
else { ele.pause(); }
|
||||
};
|
||||
|
||||
if (options.live) {
|
||||
ele.addEventListener('error',function(e){
|
||||
if ((ele.error) && (ele.error.code == 3)) {
|
||||
ele.load();
|
||||
me.addlog('Decoding error: reloading..');
|
||||
}
|
||||
},true);
|
||||
|
||||
var errorstate = false;
|
||||
function dced(e) {
|
||||
if (errorstate) { return; }
|
||||
|
||||
errorstate = true;
|
||||
me.adderror('Connection lost..');
|
||||
|
||||
var err = document.createElement('div');
|
||||
var msgnode = document.createTextNode('Connection lost..');
|
||||
err.appendChild(msgnode);
|
||||
err.className = 'error';
|
||||
var button = document.createElement('button');
|
||||
var t = document.createTextNode('Reload');
|
||||
button.appendChild(t);
|
||||
err.appendChild(button);
|
||||
button.onclick = function(){
|
||||
errorstate = false;
|
||||
ele.parentNode.removeChild(err);
|
||||
ele.load();
|
||||
ele.style.opacity = '';
|
||||
}
|
||||
err.style.position = 'absolute';
|
||||
err.style.top = 0;
|
||||
err.style.width = '100%';
|
||||
err.style['margin-left'] = 0;
|
||||
|
||||
ele.parentNode.appendChild(err);
|
||||
ele.style.opacity = '0.2';
|
||||
|
||||
function nolongerdced(){
|
||||
ele.removeEventListener('progress',nolongerdced);
|
||||
errorstate = false;
|
||||
ele.parentNode.removeChild(err);
|
||||
ele.style.opacity = '';
|
||||
}
|
||||
ele.addEventListener('progress',nolongerdced);
|
||||
}
|
||||
|
||||
//ele.addEventListener('stalled',dced,true);
|
||||
ele.addEventListener('ended',dced,true);
|
||||
}
|
||||
|
||||
this.addlog('Built html');
|
||||
|
||||
//forward events
|
||||
ele.addEventListener('error',function(e){
|
||||
me.adderror(e.message);
|
||||
},true);
|
||||
var events = ['abort','canplay','canplaythrough','durationchange','emptied','ended','interruptbegin','interruptend','loadeddata','loadedmetadata','loadstart','pause','play','playing','ratechange','seeked','seeking','stalled','volumechange','waiting'];
|
||||
for (var i in events) {
|
||||
ele.addEventListener(events[i],function(e){
|
||||
me.addlog('Player event fired: '+e.type);
|
||||
},true);
|
||||
}
|
||||
|
||||
return cont;
|
||||
}
|
||||
p.prototype.play = function(){ return this.element.play(); };
|
||||
p.prototype.pause = function(){ return this.element.pause(); };
|
||||
p.prototype.volume = function(level){
|
||||
if (typeof level == 'undefined' ) { return this.element.volume; }
|
||||
return this.element.volume = level;
|
||||
};
|
||||
p.prototype.loop = function(bool){
|
||||
if (typeof bool == 'undefined') {
|
||||
return this.element.loop;
|
||||
}
|
||||
return this.element.loop = bool;
|
||||
};
|
||||
p.prototype.load = function(){ return this.element.load(); };
|
||||
if (document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled) {
|
||||
p.prototype.fullscreen = function(){
|
||||
if(this.element.requestFullscreen) {
|
||||
return this.element.requestFullscreen();
|
||||
} else if(this.element.mozRequestFullScreen) {
|
||||
return this.element.mozRequestFullScreen();
|
||||
} else if(this.element.webkitRequestFullscreen) {
|
||||
return this.element.webkitRequestFullscreen();
|
||||
} else if(this.element.msRequestFullscreen) {
|
||||
return this.element.msRequestFullscreen();
|
||||
}
|
||||
};
|
||||
}
|
||||
p.prototype.setTracks = function(usetracks){
|
||||
function urlAddParam(url,params) {
|
||||
var spliturl = url.split('?');
|
||||
var ret = [spliturl.shift()];
|
||||
var splitparams = [];
|
||||
if (spliturl.length) {
|
||||
splitparams = spliturl[0].split('&');
|
||||
}
|
||||
for (var i in params) {
|
||||
splitparams.push(i+'='+params[i]);
|
||||
}
|
||||
if (splitparams.length) { ret.push(splitparams.join('&')); }
|
||||
return ret.join('?');
|
||||
}
|
||||
|
||||
if ('subtitle' in usetracks) {
|
||||
//remove previous subtitles
|
||||
var ts = this.element.getElementsByTagName('track');
|
||||
for (var i = ts.length - 1; i >= 0; i--) {
|
||||
this.element.removeChild(ts[i]);
|
||||
}
|
||||
var tracks = this.tracks.subtitle;
|
||||
for (var i in tracks) {
|
||||
if (tracks[i].trackid == usetracks.subtitle) {
|
||||
var t = document.createElement('track');
|
||||
this.element.appendChild(t);
|
||||
t.kind = 'subtitles';
|
||||
t.label = tracks[i].desc;
|
||||
t.srclang = tracks[i].lang;
|
||||
t.src = this.subtitle+'?track='+tracks[i].trackid;
|
||||
t.setAttribute('default','');
|
||||
break;
|
||||
}
|
||||
}
|
||||
delete usetracks.subtitle;
|
||||
if (Object.keys(usetracks).length == 0) { return true; }
|
||||
}
|
||||
|
||||
var time = this.element.currentTime;
|
||||
this.source.setAttribute('src',urlAddParam(this.options.src,usetracks));
|
||||
if (this.element.readyState) {
|
||||
this.element.load();
|
||||
}
|
||||
|
||||
this.element.currentTime = time;
|
||||
|
||||
if ('trackselects' in this) {
|
||||
for (var i in usetracks) {
|
||||
if (i in this.trackselects) { this.trackselects[i].value = usetracks[i]; }
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
p.prototype.resize = function(size){
|
||||
this.element.width = size.width;
|
||||
this.element.height = size.height;
|
||||
};
|
39
embed/wrappers/jwplayer.js
Normal file
39
embed/wrappers/jwplayer.js
Normal file
|
@ -0,0 +1,39 @@
|
|||
mistplayers.jwplayer = {
|
||||
name: 'JWPlayer',
|
||||
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) {
|
||||
return (this.mimes.indexOf(mimetype) == -1 ? false : true);
|
||||
},
|
||||
isBrowserSupported: function (mimetype) {
|
||||
//TODO like, actually check the browser or something?
|
||||
if (typeof jwplayer == 'function') {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
player: function(){}
|
||||
};
|
||||
var p = mistplayers.jwplayer.player;
|
||||
p.prototype = new MistPlayer();
|
||||
p.prototype.build = function (options) {
|
||||
var ele = this.element('div');
|
||||
|
||||
this.jw = jwplayer(ele).setup({
|
||||
file: options.src,
|
||||
width: options.width,
|
||||
height: options.height,
|
||||
autostart: options.autoplay,
|
||||
image: options.poster,
|
||||
controls: options.controls
|
||||
});
|
||||
|
||||
this.addlog('Built html');
|
||||
return ele;
|
||||
}
|
||||
p.prototype.play = function(){ return this.jw.play(); };
|
||||
p.prototype.pause = function(){ return this.jw.pause(); };
|
||||
p.prototype.volume = function(level){
|
||||
if (typeof level == 'undefined' ) { return this.jw.getVolume/100; }
|
||||
return this.jw.setVolume(level*100);
|
||||
};
|
100
embed/wrappers/polytrope.js
Normal file
100
embed/wrappers/polytrope.js
Normal file
|
@ -0,0 +1,100 @@
|
|||
mistplayers.polytrope = {
|
||||
name: 'Polytrope Flash Player',
|
||||
mimes: ['flash/11','flash/10','flash/7'],
|
||||
priority: Object.keys(mistplayers).length + 1,
|
||||
isMimeSupported: function (mimetype) {
|
||||
return (this.mimes.indexOf(mimetype) == -1 ? false : true);
|
||||
},
|
||||
isBrowserSupported: function (mimetype) {
|
||||
return false;
|
||||
|
||||
var version = 0;
|
||||
try {
|
||||
// check in the mimeTypes
|
||||
version = navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin.description.replace(/([^0-9\.])/g, '').split('.')[0];
|
||||
} catch(e){}
|
||||
try {
|
||||
// for our special friend IE
|
||||
version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable("$version").replace(/([^0-9\,])/g, '').split(',')[0];
|
||||
} catch(e){}
|
||||
|
||||
var mimesplit = mimetype.split('/');
|
||||
|
||||
return Number(version) >= Number(mimesplit[mimesplit.length-1]);
|
||||
},
|
||||
player: function(){}
|
||||
};
|
||||
var p = mistplayers.polytrope.player;
|
||||
p.prototype = new MistPlayer();
|
||||
p.prototype.build = function (options) {
|
||||
function createParam(name,value) {
|
||||
var p = document.createElement('param');
|
||||
p.setAttribute('name',name);
|
||||
p.setAttribute('value',value);
|
||||
return p;
|
||||
}
|
||||
|
||||
//TODO its not working.
|
||||
|
||||
/*
|
||||
this.swf = this.video_instance_el.flash({
|
||||
swf: "/shared/swf/videoplayer.swf?" + (new Date).getTime(),
|
||||
width: "100%",
|
||||
height: parseInt(this.options.element.height()),
|
||||
wmode: "opaque",
|
||||
menu: "false",
|
||||
allowFullScreen: "true",
|
||||
allowFullScreenInteractive: "true",
|
||||
allowScriptAccess: "always",
|
||||
id: "cucumbertv-swf-" + this.guid,
|
||||
expressInstall: "/shared/swf/expressInstall.swf",
|
||||
flashvars: {
|
||||
rtmp_url: "rtmp://" + this.options.stream_host + "/play/",
|
||||
stream_name: this.options.stream_name,
|
||||
poster: this.options.poster,
|
||||
autoplay: this.options.autoplay,
|
||||
color_1: "0x1d1d1d",
|
||||
color_2: "0xffffff",
|
||||
buffer_time: .1,
|
||||
is_streaming_url: "/api/user/is_streaming",
|
||||
username: this.options.username,
|
||||
mode: "v" == this.options.type ? "archive" : "live",
|
||||
guid: this.guid
|
||||
}
|
||||
})
|
||||
|
||||
<div>
|
||||
<object data="/shared/swf/videoplayer.swf?1468312898591" type="application/x-shockwave-flash" id="cucumbertv-swf-4dc64c18-59af-91a2-d0c5-ab8df4f45c65" width="100%" height="660">
|
||||
<param name="wmode" value="opaque">
|
||||
<param name="menu" value="false">
|
||||
<param name="allowFullScreen" value="true">
|
||||
<param name="allowFullScreenInteractive" value="true">
|
||||
<param name="allowScriptAccess" value="always">
|
||||
<param name="expressInstall" value="/shared/swf/expressInstall.swf">
|
||||
<param name="flashvars" value="rtmp_url=rtmp://www.stickystage.com/play/&stream_name=stickystage_archive+SrA-2016.07.08.23.54.08&poster=/stickystage/users/SrA/archive/SrA-2016.07.08.23.54.08.jpg&autoplay=true&color_1=0x1d1d1d&color_2=0xffffff&buffer_time=0.1&is_streaming_url=/api/user/is_streaming&username=SrA&mode=archive&guid=4dc64c18-59af-91a2-d0c5-ab8df4f45c65">
|
||||
<param name="movie" value="/shared/swf/videoplayer.swf?1468312898591">
|
||||
</object>
|
||||
</div>
|
||||
*/
|
||||
|
||||
|
||||
|
||||
var ele = this.element('object');
|
||||
ele.data = 'players/polytrope.swf';
|
||||
ele.type = 'application/x-shockwave-flash';
|
||||
ele.width = options.width;
|
||||
ele.height = options.height;
|
||||
|
||||
/*
|
||||
ele.appendChild(createParam('allowFullScreen','true'));
|
||||
ele.appendChild(createParam('allowScriptAccess','always'));
|
||||
var flashvars = 'rtmp_url=rtmp://www.stickystage.com/play/&stream_name=stickystage_archive+SrA-2016.07.08.23.54.08&poster=/stickystage/users/SrA/archive/SrA-2016.07.08.23.54.08.jpg&autoplay=true&color_1=0x1d1d1d&color_2=0xffffff&buffer_time=0.1&is_streaming_url=/api/user/is_streaming&username=SrA&mode=archive&guid=4dc64c18-59af-91a2-d0c5-ab8df4f45c65';
|
||||
ele.appendChild(createParam('flashvars',flashvars));
|
||||
ele.appendChild(createParam('movie','players/polytrope.swf'));
|
||||
*/
|
||||
|
||||
ele.innerHTML = '<param name="wmode" value="opaque"> <param name="menu" value="false"> <param name="allowFullScreen" value="true"> <param name="allowFullScreenInteractive" value="true"> <param name="allowScriptAccess" value="always"> <param name="expressInstall" value="/shared/swf/expressInstall.swf"> <param name="flashvars" value="rtmp_url=rtmp://www.stickystage.com/play/&stream_name=stickystage_archive+SrA-2016.07.08.23.54.08&poster=http://stickystage.com/stickystage/users/SrA/archive/SrA-2016.07.08.23.54.08.jpg&autoplay=true&color_1=0x1d1d1d&color_2=0xffffff&buffer_time=0.1&is_streaming_url=/api/user/is_streaming&username=SrA&mode=archive&guid=4dc64c18-59af-91a2-d0c5-ab8df4f45c65"> <param name="movie" value="players/polytrope.swf">';
|
||||
|
||||
this.addlog('Built html');
|
||||
return ele;
|
||||
}
|
55
embed/wrappers/silverlight.js
Normal file
55
embed/wrappers/silverlight.js
Normal file
|
@ -0,0 +1,55 @@
|
|||
mistplayers.silverlight = {
|
||||
name: 'Silverlight',
|
||||
mimes: ['silverlight'],
|
||||
priority: Object.keys(mistplayers).length + 1,
|
||||
isMimeSupported: function (mimetype) {
|
||||
return (this.mimes.indexOf(mimetype) == -1 ? false : true);
|
||||
},
|
||||
isBrowserSupported: function (mimetype) {
|
||||
var plugin;
|
||||
try {
|
||||
// check in the mimeTypes
|
||||
plugin = navigator.plugins["Silverlight Plug-In"];
|
||||
return !!plugin;
|
||||
} catch(e){}
|
||||
try {
|
||||
// for our special friend IE
|
||||
plugin = new ActiveXObject('AgControl.AgControl');
|
||||
return true;
|
||||
} catch(e){}
|
||||
|
||||
return false;
|
||||
},
|
||||
player: function(){}
|
||||
};
|
||||
var p = mistplayers.silverlight.player;
|
||||
p.prototype = new MistPlayer();
|
||||
p.prototype.build = function (options) {
|
||||
function createParam(name,value) {
|
||||
var p = document.createElement('param');
|
||||
p.setAttribute('name',name);
|
||||
p.setAttribute('value',value);
|
||||
return p;
|
||||
}
|
||||
|
||||
var ele = this.element('object');
|
||||
ele.setAttribute('data','data:application/x-silverlight,');
|
||||
ele.setAttribute('type','application/x-silverlight');
|
||||
ele.setAttribute('width',options.width);
|
||||
ele.setAttribute('height',options.height);
|
||||
ele.appendChild(createParam('source',encodeURI(options.src)+'/player.xap'));
|
||||
ele.appendChild(createParam('initparams','autoload=false,'+(options.autoplay ? 'autoplay=true' : 'autoplay=false')+',displaytimecode=false,enablecaptions=true,joinLive=true,muted=false'));
|
||||
|
||||
var a = document.createElement('a');
|
||||
ele.appendChild(a);
|
||||
a.setAttribute('href','http://go.microsoft.com/fwlink/?LinkID=124807');
|
||||
a.setAttribute('style','text-decoration: none;');
|
||||
var img = document.createElement('img');
|
||||
a.appendChild(img);
|
||||
img.setAttribute('src','http://go.microsoft.com/fwlink/?LinkId=108181');
|
||||
img.setAttribute('alt','Get Microsoft Silverlight');
|
||||
img.setAttribute('style','border-style: none;')
|
||||
|
||||
this.addlog('Built html');
|
||||
return ele;
|
||||
}
|
23
embed/wrappers/template.js
Normal file
23
embed/wrappers/template.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
mistplayers.myplayer = {
|
||||
name: 'My video player',
|
||||
mimes: ['my/mime/types'],
|
||||
priority: Object.keys(mistplayers).length + 1,
|
||||
isMimeSupported: function (mimetype) {
|
||||
return (this.mimes.indexOf(mimetype) == -1 ? false : true);
|
||||
},
|
||||
isBrowserSupported: function (mimetype) {
|
||||
//TODO your code here
|
||||
return false;
|
||||
},
|
||||
player: function(){}
|
||||
};
|
||||
var p = mistplayers.myplayer.player;
|
||||
p.prototype = new MistPlayer();
|
||||
p.prototype.build = function (options) {
|
||||
var ele = this.element('object');
|
||||
|
||||
//TODO your code here
|
||||
|
||||
this.addlog('Built html');
|
||||
return ele;
|
||||
}
|
52
embed/wrappers/theoplayer.js
Normal file
52
embed/wrappers/theoplayer.js
Normal file
|
@ -0,0 +1,52 @@
|
|||
mistplayers.theoplayer = {
|
||||
name: 'TheoPlayer',
|
||||
mimes: ['html5/application/vnd.apple.mpegurl','dash/video/mp4'],
|
||||
priority: Object.keys(mistplayers).length + 1,
|
||||
isMimeSupported: function (mimetype) {
|
||||
return (this.mimes.indexOf(mimetype) == -1 ? false : true);
|
||||
},
|
||||
isBrowserSupported: function (mimetype) {
|
||||
//TODO like, actually check the browser or something?
|
||||
if (typeof theoplayer == 'function') {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
player: function(){}
|
||||
};
|
||||
var p = mistplayers.theoplayer.player;
|
||||
p.prototype = new MistPlayer();
|
||||
p.prototype.build = function (options) {
|
||||
var ele = this.element('video');
|
||||
|
||||
ele.src = options.src;
|
||||
ele.width = options.width;
|
||||
ele.height = options.height;
|
||||
|
||||
if (options.controls) {
|
||||
ele.setAttribute('controls','');
|
||||
}
|
||||
if (options.autoplay) {
|
||||
ele.setAttribute('autoplay','');
|
||||
}
|
||||
if (options.loop) {
|
||||
ele.setAttribute('loop','');
|
||||
}
|
||||
if (options.poster) {
|
||||
ele.setAttribute('poster',options.poster);
|
||||
}
|
||||
|
||||
this.theoplayer = theoplayer(ele);
|
||||
|
||||
this.addlog('Built html');
|
||||
return ele;
|
||||
}
|
||||
p.prototype.play = function(){ return this.theoplayer.play(); };
|
||||
p.prototype.pause = function(){ return this.theoplayer.pause(); };
|
||||
p.prototype.volume = function(level){
|
||||
if (typeof level == 'undefined' ) { return this.theoplayer.volume; }
|
||||
return this.theoplayer.volume = level;
|
||||
};
|
||||
p.prototype.fullscreen = function(){
|
||||
return this.theoplayer.requestFullscreen();
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue