embed.js error fix

This commit is contained in:
Niels Groot Obbink 2012-08-29 16:19:34 +02:00
parent 4257ac6634
commit 8d5d15669f

View file

@ -1,8 +1,9 @@
function mistembed(video)
{
// add stuff to mistvideo object, if it doesn't exist yet
if(!mistvideo.hasSupport || !mistvideo.buildPlayer)
function mistembed(streamname)
{
// add stuff to mistvideo object, if it doesn't exist yet
if(!mistvideo.hasSupport || !mistvideo.buildPlayer)
{
// return the current flash version
mistvideo.flashVersion = function()
{
@ -61,30 +62,31 @@ if(!mistvideo.hasSupport || !mistvideo.buildPlayer)
break;
}
};
}
}
var container = document.createElement('div'),
var video = mistvideo[streamname],
container = document.createElement('div'),
scripts = document.getElementsByTagName('script'),
me = scripts[scripts.length - 1];
// create the container
me.parentNode.insertBefore(container, me);
// set the class to 'mistvideo'
container.setAttribute('class', 'mistvideo');
// remove script tag
me.parentNode.removeChild(me);
// create the container
me.parentNode.insertBefore(container, me);
// set the class to 'mistvideo'
container.setAttribute('class', 'mistvideo');
// remove script tag
me.parentNode.removeChild(me);
if(video.error)
{
if(video.error)
{
// there was an error; display it
container.innerHTML = ['<strong>Error: ', video.error, '</strong>'].join('');
}else if(video.source.length < 1)
{
}else if(video.source.length < 1)
{
// no stream sources
container.innerHTML = '<strong>Error: no streams found</strong>';
}else{
}else{
// no error, and sources found. Check the video types and output the best
// available video player.
var i, video
@ -109,7 +111,6 @@ if(video.error)
// of all the streams given, none was supported (eg. no flash and HTML5 video). Fall back.
container.innerHTML = 'fallback here';
}
}
}
}