embed.js error fix
This commit is contained in:
parent
4257ac6634
commit
8d5d15669f
1 changed files with 100 additions and 99 deletions
39
src/embed.js
39
src/embed.js
|
@ -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';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue