moar fixes... D:
This commit is contained in:
parent
8d5d15669f
commit
d357065b92
1 changed files with 52 additions and 55 deletions
31
src/embed.js
31
src/embed.js
|
@ -1,11 +1,7 @@
|
||||||
function mistembed(streamname)
|
function mistembed(streamname)
|
||||||
{
|
|
||||||
|
|
||||||
// add stuff to mistvideo object, if it doesn't exist yet
|
|
||||||
if(!mistvideo.hasSupport || !mistvideo.buildPlayer)
|
|
||||||
{
|
{
|
||||||
// return the current flash version
|
// return the current flash version
|
||||||
mistvideo.flashVersion = function()
|
function flashVersion()
|
||||||
{
|
{
|
||||||
var version = 0;
|
var version = 0;
|
||||||
|
|
||||||
|
@ -21,35 +17,36 @@ function mistembed(streamname)
|
||||||
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){}
|
}catch(e){}
|
||||||
|
|
||||||
return version;
|
return parseInt(version, 10);
|
||||||
};
|
};
|
||||||
|
|
||||||
// what does the browser support - used in hasSupport()
|
// what does the browser support - used in hasSupport()
|
||||||
mistvideo.supports =
|
supports =
|
||||||
{
|
{
|
||||||
flashversion: parseInt(mistvideo.flashVersion(), 10)
|
flashversion: flashVersion()
|
||||||
};
|
};
|
||||||
|
|
||||||
// return true if a type is supported
|
// return true if a type is supported
|
||||||
mistvideo.hasSupport = function(type)
|
function hasSupport(type)
|
||||||
{
|
{
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
case 'f4v': return mistvideo.supports.flashversion >= 11; break;
|
case 'f4v': return supports.flashversion >= 11; break;
|
||||||
case 'rtmp': return mistvideo.supports.flashversion >= 10; break;
|
case 'rtmp': return supports.flashversion >= 10; break;
|
||||||
case 'flv': return mistvideo.supports.flashversion >= 7; break;
|
case 'flv': return supports.flashversion >= 7; break;
|
||||||
|
|
||||||
default: return false;
|
default: return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// build HTML for certain kinds of types
|
// build HTML for certain kinds of types
|
||||||
mistvideo.buildPlayer = function(src, container, width, height)
|
function buildPlayer(src, container, width, height)
|
||||||
{
|
{
|
||||||
|
// get the container's width/height
|
||||||
cwidth = parseInt(container.style.width, 10);
|
cwidth = parseInt(container.style.width, 10);
|
||||||
cheight = parseInt(container.style.height, 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;
|
width = cwidth < width ? cwidth : width;
|
||||||
height = cheight < height ? cheight : height;
|
height = cheight < height ? cheight : height;
|
||||||
|
|
||||||
|
@ -62,7 +59,7 @@ function mistembed(streamname)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,10 +92,10 @@ function mistembed(streamname)
|
||||||
|
|
||||||
for(i = 0; i < len; i++)
|
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.
|
// 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
|
// we've build a player, so we're done here
|
||||||
foundPlayer = true;
|
foundPlayer = true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue