preview embed type selectors NB: changes to embed.js
This commit is contained in:
parent
20ef805c0c
commit
9b9923b6d5
4 changed files with 127 additions and 61 deletions
|
@ -115,6 +115,7 @@ function mistembed(streamname)
|
|||
}
|
||||
|
||||
var maintype = parseType(src.type);
|
||||
mistvideo[streamname].embedded_type = src.type;
|
||||
|
||||
switch(maintype[0])
|
||||
{
|
||||
|
@ -130,7 +131,7 @@ function mistembed(streamname)
|
|||
flashplayer = 'http://fpdownload.adobe.com/strobe/FlashMediaPlayback.swf';
|
||||
}
|
||||
|
||||
container.innerHTML = '<object width="' + videowidth + '" height="' + videoheight + '">' +
|
||||
container.innerHTML += '<object width="' + videowidth + '" height="' + videoheight + '">' +
|
||||
'<param name="movie" value="' + flashplayer + '"></param>' +
|
||||
'<param name="flashvars" value="src=' + url + '"></param>' +
|
||||
'<param name="allowFullScreen" value="true"></param>' +
|
||||
|
@ -141,27 +142,30 @@ function mistembed(streamname)
|
|||
break;
|
||||
|
||||
case 'html5':
|
||||
container.innerHTML = '<video width="' + videowidth + '" height="' + videoheight + '" src="' + encodeURI(src.url) + '" controls="controls" ><strong>No HTML5 video support</strong></video>';
|
||||
container.innerHTML += '<video width="' + videowidth + '" height="' + videoheight + '" src="' + encodeURI(src.url) + '" controls="controls" ><strong>No HTML5 video support</strong></video>';
|
||||
break;
|
||||
|
||||
case 'silverlight':
|
||||
container.innerHTML = '<object data="data:application/x-silverlight," type="application/x-silverlight" width="' + videowidth + '" height="' + videoheight + '"><param name="source" value="' + encodeURI(src.url) + '/player.xap"/><param name="onerror" value="onSilverlightError" /><param name="autoUpgrade" value="true" /><param name="background" value="white" /><param name="enableHtmlAccess" value="true" /><param name="minRuntimeVersion" value="3.0.40624.0" /><param name="initparams" value =\'autoload=false,autoplay=true,displaytimecode=false,enablecaptions=true,joinLive=true,muted=false,playlist=<playList><playListItems><playListItem title="Test" description="testing" mediaSource="' + encodeURI(src.url) + '" adaptiveStreaming="true" thumbSource="" frameRate="25.0" width="" height=""></playListItem></playListItems></playList>\' /><a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"> <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" /></a></object>';
|
||||
container.innerHTML += '<object data="data:application/x-silverlight," type="application/x-silverlight" width="' + videowidth + '" height="' + videoheight + '"><param name="source" value="' + encodeURI(src.url) + '/player.xap"/><param name="onerror" value="onSilverlightError" /><param name="autoUpgrade" value="true" /><param name="background" value="white" /><param name="enableHtmlAccess" value="true" /><param name="minRuntimeVersion" value="3.0.40624.0" /><param name="initparams" value =\'autoload=false,autoplay=true,displaytimecode=false,enablecaptions=true,joinLive=true,muted=false,playlist=<playList><playListItems><playListItem title="Test" description="testing" mediaSource="' + encodeURI(src.url) + '" adaptiveStreaming="true" thumbSource="" frameRate="25.0" width="" height=""></playListItem></playListItems></playList>\' /><a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"> <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" /></a></object>';
|
||||
break;
|
||||
|
||||
|
||||
case 'fallback':
|
||||
container.innerHTML = '<strong>No support for any player found</strong>';
|
||||
container.innerHTML += '<strong>No support for any player found</strong>';
|
||||
break;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
var video = mistvideo[streamname],
|
||||
container = document.createElement('div'),
|
||||
scripts = document.getElementsByTagName('script'),
|
||||
me = scripts[scripts.length - 1];
|
||||
|
||||
if (me.parentNode.hasAttribute('data-forcetype')) {
|
||||
var forceType = me.parentNode.getAttribute('data-forcetype');
|
||||
}
|
||||
|
||||
if (video.width == 0) { video.width = 250; }
|
||||
if (video.height == 0) { video.height = 250; }
|
||||
|
||||
|
@ -187,26 +191,44 @@ function mistembed(streamname)
|
|||
vtype = (video.type ? video.type : 'unknown'),
|
||||
foundPlayer = false,
|
||||
len = video.source.length;
|
||||
|
||||
for(i = 0; i < len; i++)
|
||||
{
|
||||
//console.log("trying support for type " + video.source[i].type + " (" + parseType(video.source[i].type)[0] + " - " + parseType(video.source[i].type)[1] + ")");
|
||||
if( hasSupport( video.source[i].type ) )
|
||||
{
|
||||
// we support this kind of video, so build it.
|
||||
buildPlayer(video.source[i], container.parentNode, video.width, video.height, vtype);
|
||||
|
||||
// we've build a player, so we're done here
|
||||
foundPlayer = true;
|
||||
break; // break for() loop
|
||||
|
||||
if (typeof forceType != 'undefined') {
|
||||
i = forceType;
|
||||
if (typeof video.source[i] == 'undefined') {
|
||||
container.innerHTML = '<strong>Invalid force integer ('+i+').</strong>';
|
||||
}
|
||||
else {
|
||||
if ( hasSupport(video.source[i].type) ) {
|
||||
buildPlayer(video.source[i], container.parentNode, video.width, video.height, vtype);
|
||||
}
|
||||
else {
|
||||
container.innerHTML = '<strong>Your browser does not support the type "'+video.source[i].type+'".</strong>';
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
for(i = 0; i < len; i++)
|
||||
{
|
||||
//console.log("trying support for type " + video.source[i].type + " (" + parseType(video.source[i].type)[0] + " - " + parseType(video.source[i].type)[1] + ")");
|
||||
if( hasSupport( video.source[i].type ) )
|
||||
{
|
||||
// we support this kind of video, so build it.
|
||||
buildPlayer(video.source[i], container.parentNode, video.width, video.height, vtype);
|
||||
|
||||
if(!foundPlayer)
|
||||
{
|
||||
// of all the streams given, none was supported (eg. no flash and HTML5 video). Display error
|
||||
buildPlayer({type: 'fallback'}, container.parentNode, video.width, video.height);
|
||||
// we've build a player, so we're done here
|
||||
foundPlayer = true;
|
||||
break; // break for() loop
|
||||
}
|
||||
}
|
||||
|
||||
if(!foundPlayer)
|
||||
{
|
||||
// of all the streams given, none was supported (eg. no flash and HTML5 video). Display error
|
||||
buildPlayer({type: 'fallback'}, container.parentNode, video.width, video.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return (typeof mistvideo[streamname].embedded_type != 'undefined' ? mistvideo[streamname].embedded_type : false);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue