Embed rework
This commit is contained in:
parent
98054f268f
commit
ac7659614a
58 changed files with 8278 additions and 49187 deletions
|
@ -1,26 +1,37 @@
|
|||
mistplayers.flash_strobe = {
|
||||
name: 'Strobe Flash Media Playback',
|
||||
version: '1.1',
|
||||
mimes: ['flash/10','flash/11','flash/7'],
|
||||
priority: Object.keys(mistplayers).length + 1,
|
||||
name: "Strobe Flash media playback",
|
||||
mimes: ["flash/10","flash/11","flash/7"],
|
||||
priority: MistUtil.object.keys(mistplayers).length + 1,
|
||||
isMimeSupported: function (mimetype) {
|
||||
return (this.mimes.indexOf(mimetype) == -1 ? false : true);
|
||||
},
|
||||
isBrowserSupported: function (mimetype,source,options) {
|
||||
//check for http / https crossovers
|
||||
if ((options.host.substr(0,7) == 'http://') && (source.url.substr(0,8) == 'https://')) { return false; }
|
||||
isBrowserSupported: function (mimetype,source,MistVideo) {
|
||||
|
||||
//check for http/https mismatch
|
||||
if ((MistUtil.http.url.split(source.url).protocol.slice(0,4) == "http") && (location.protocol != MistUtil.http.url.split(source.url).protocol)) {
|
||||
MistVideo.log("HTTP/HTTPS mismatch for this source");
|
||||
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];
|
||||
var plugin = navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;
|
||||
if (plugin.version) { version = plugin.version.split(".")[0]; }
|
||||
else { version = plugin.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];
|
||||
version = new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").replace(/([^0-9\,])/g, "").split(",")[0];
|
||||
} catch(e){}
|
||||
|
||||
var mimesplit = mimetype.split('/');
|
||||
if (!version) {
|
||||
//flash is not enabled? Might need to ask permission first.
|
||||
//TODO how? just let it build?
|
||||
return false;
|
||||
}
|
||||
|
||||
var mimesplit = mimetype.split("/");
|
||||
|
||||
return Number(version) >= Number(mimesplit[mimesplit.length-1]);
|
||||
},
|
||||
|
@ -28,39 +39,53 @@ mistplayers.flash_strobe = {
|
|||
};
|
||||
var p = mistplayers.flash_strobe.player;
|
||||
p.prototype = new MistPlayer();
|
||||
p.prototype.build = function (options,callback) {
|
||||
function createParam(name,value) {
|
||||
var p = document.createElement('param');
|
||||
p.setAttribute('name',name);
|
||||
p.setAttribute('value',value);
|
||||
return p;
|
||||
}
|
||||
p.prototype.build = function (MistVideo,callback) {
|
||||
|
||||
|
||||
var ele = this.getElement('object');
|
||||
|
||||
ele.setAttribute('width',options.width);
|
||||
ele.setAttribute('height',options.height);
|
||||
|
||||
ele.appendChild(createParam('movie',options.host+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');
|
||||
var ele = document.createElement("object");
|
||||
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);
|
||||
|
||||
function build(source) {
|
||||
var options = MistVideo.options;
|
||||
function createParam(name,value) {
|
||||
var p = document.createElement("param");
|
||||
p.setAttribute("name",name);
|
||||
p.setAttribute("value",value);
|
||||
return p;
|
||||
}
|
||||
|
||||
MistUtil.empty(ele);
|
||||
ele.appendChild(createParam("movie",MistVideo.urlappend(options.host+MistVideo.source.player_url)));
|
||||
var flashvars = "src="+encodeURIComponent(source)+"&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"));
|
||||
}
|
||||
|
||||
e.setAttribute("src",MistVideo.urlappend(MistVideo.source.player_url));
|
||||
e.setAttribute("type","application/x-shockwave-flash");
|
||||
e.setAttribute("allowfullscreen","true");
|
||||
e.setAttribute("flashvars",flashvars);
|
||||
}
|
||||
build(MistVideo.source.url);
|
||||
|
||||
this.addlog('Built html');
|
||||
this.api = {};
|
||||
this.setSize = function(size){
|
||||
ele.setAttribute("width",size.width);
|
||||
ele.setAttribute("height",size.height);
|
||||
e.setAttribute("width",size.width);
|
||||
e.setAttribute("height",size.height);
|
||||
};
|
||||
this.setSize(MistVideo.calcSize());
|
||||
this.onready(function(){
|
||||
if (MistVideo.container) { MistVideo.container.removeAttribute("data-loading"); }
|
||||
});
|
||||
this.api.setSource = function(url){
|
||||
build(url);
|
||||
}
|
||||
|
||||
MistVideo.log("Built html");
|
||||
callback(ele);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue