moar fixes... D:

This commit is contained in:
Niels Groot Obbink 2012-08-29 16:27:16 +02:00
parent 8d5d15669f
commit d357065b92

View file

@ -1,68 +1,65 @@
function mistembed(streamname)
{
// add stuff to mistvideo object, if it doesn't exist yet
if(!mistvideo.hasSupport || !mistvideo.buildPlayer)
// return the current flash version
function flashVersion()
{
// return the current flash version
mistvideo.flashVersion = function()
var version = 0;
try
{
var version = 0;
// check in the mimeTypes
version = navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin.description.replace(/([^0-9\.])/g, '').split('.')[0];
}catch(e){}
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){}
return version;
};
// what does the browser support - used in hasSupport()
mistvideo.supports =
try
{
flashversion: parseInt(mistvideo.flashVersion(), 10)
};
// for our special friend IE
version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable("$version").replace(/([^0-9\,])/g, '').split(',')[0];
}catch(e){}
// return true if a type is supported
mistvideo.hasSupport = function(type)
return parseInt(version, 10);
};
// what does the browser support - used in hasSupport()
supports =
{
flashversion: flashVersion()
};
// return true if a type is supported
function hasSupport(type)
{
switch(type)
{
switch(type)
{
case 'f4v': return mistvideo.supports.flashversion >= 11; break;
case 'rtmp': return mistvideo.supports.flashversion >= 10; break;
case 'flv': return mistvideo.supports.flashversion >= 7; break;
case 'f4v': return supports.flashversion >= 11; break;
case 'rtmp': return supports.flashversion >= 10; break;
case 'flv': return supports.flashversion >= 7; break;
default: return false;
}
};
default: return false;
}
};
// build HTML for certain kinds of types
mistvideo.buildPlayer = function(src, container, width, height)
// build HTML for certain kinds of types
function buildPlayer(src, container, width, height)
{
// get the container's width/height
cwidth = parseInt(container.style.width, 10);
cheight = parseInt(container.style.height, 10);
// video's max width/height is either the containers width/height (if it's smaller then the video) or the video's size
width = cwidth < width ? cwidth : width;
height = cheight < height ? cheight : height;
switch(src.type)
{
case 'f4v':
case 'rtmp':
case 'flv':
container.innerHTML = '<object width="' + width + '" height="' + height + '"><param name="movie" value="http://fpdownload.adobe.com/strobe/FlashMediaPlayback.swf"></param><param name="flashvars" value="src=' + encodeURI(src.url) + '&controlBarMode=floating"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://fpdownload.adobe.com/strobe/FlashMediaPlayback.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="' + width + '" height="' + height + '" flashvars="src=' + encodeURI(src.url) + '&controlBarMode=floating"></embed></object>';
break;
}
};
cwidth = parseInt(container.style.width, 10);
cheight = parseInt(container.style.height, 10);
width = cwidth < width ? cwidth : width;
height = cheight < height ? cheight : height;
switch(src.type)
{
case 'f4v':
case 'rtmp':
case 'flv':
container.innerHTML = '<object width="' + width + '" height="' + height + '"><param name="movie" value="http://fpdownload.adobe.com/strobe/FlashMediaPlayback.swf"></param><param name="flashvars" value="src=' + encodeURI(src.url) + '&controlBarMode=floating"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://fpdownload.adobe.com/strobe/FlashMediaPlayback.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="' + width + '" height="' + height + '" flashvars="src=' + encodeURI(src.url) + '&controlBarMode=floating"></embed></object>';
break;
}
};
}
@ -95,10 +92,10 @@ function mistembed(streamname)
for(i = 0; i < len; i++)
{
if( mistvideo.hasSupport( video.source[i].type ) )
if( hasSupport( video.source[i].type ) )
{
// we support this kind of video, so build it.
mistvideo.buildPlayer(video.source[i], container, video.width, video.height);
buildPlayer(video.source[i], container, video.width, video.height);
// we've build a player, so we're done here
foundPlayer = true;