diff --git a/src/connectors/embed.js b/src/connectors/embed.js
index 1c3cb77e..cad98d61 100644
--- a/src/connectors/embed.js
+++ b/src/connectors/embed.js
@@ -28,7 +28,7 @@ function mistembed(streamname)
{
// check in the mimeTypes
plugin = navigator.plugins["Silverlight Plug-In"];
- return true;
+ return !!plugin;
}catch(e){}
try
{
@@ -58,43 +58,23 @@ function mistembed(streamname)
return support;
}
- // what does the browser support - used in hasSupport()
- supports =
- {
- flashversion: flash_version(),
- hls: html5_video_type('application/vnd.apple.mpegurl'),
- ism_html5: html5_video_type('application/vnd.ms-ss'),
- ism: html5_video_type('application/vnd.ms-ss') || silverlight_installed(),
- mp4: html5_video_type('video/mp4'),
- ogg: html5_video_type('video/ogg')
- }
-
+
// return true if a type is supported
function hasSupport(type)
{
- switch(type)
+ var typemime = type.split('/');
+
+ switch(typemime[0])
{
- case 'flash': return supports.flashversion != 0; break;
- case 'hls': return supports.hls; break;
- case 'ism': return supports.ism; break;
- case 'mp4': return supports.mp4; break;
- case 'ogg': return supports.ogg; break;
+ case 'flash': return flash_version() >= parseInt(typemime[1], 10); break;
+ case 'html5': return html5_video_type(typemime[1]); break;
+ case 'silverlight': return silverlight_installed(); break;
- default:
- // check for flash/# type
- var flashver = parseInt( type.replace('flash/', ''), 10);
-
- if( flashver != NaN )
- {
- return supports.flashversion >= flashver;
- }
-
- // unknown type
- return false;
- break;
+ default: return false; break;
}
};
+
// build HTML for certain kinds of types
function buildPlayer(src, container, videowidth, videoheight, vtype)
{
@@ -121,15 +101,15 @@ function mistembed(streamname)
videoheight /= ratio;
}
- var flashplayer,
- url = encodeURIComponent(src.url) + '&controlBarMode=floating&initialBufferTime=0.5&expandedBufferTime=5&minContinuousPlaybackTime=3' + (vtype == 'live' ? "&streamType=live" : ""),
- maintype = src.type.split('/');
+ var maintype = src.type.split('/');
switch(maintype[0])
{
case 'flash':
-
// maintype[1] is already checked (i.e. user has version > maintype[1])
+ var flashplayer,
+ url = encodeURIComponent(src.url) + '&controlBarMode=floating&initialBufferTime=0.5&expandedBufferTime=5&minContinuousPlaybackTime=3' + (vtype == 'live' ? "&streamType=live" : ""),
+
if( parseInt(maintype[1], 10) >= 10 )
{
flashplayer = 'http://fpdownload.adobe.com/strobe/FlashMediaPlayback_101.swf';
@@ -147,18 +127,12 @@ function mistembed(streamname)
'';
break;
- case 'ism':
- if( supports.ism_html5 )
- {
- container.innerHTML = '';
- }else{
- container.innerHTML = '';
- }
-
- case 'ogg':
- case 'mp4':
- case 'hls':
+ case 'html5':
container.innerHTML = '';
+ break;
+
+ case 'silverlight':
+ container.innerHTML = '';
break;
@@ -170,47 +144,6 @@ function mistembed(streamname)
};
- // sort the videos
- function priority_sort( videos )
- {
- var i, p,
- len = videos.length;
-
- for( i = 0; i < len; i++ )
- {
- switch( videos[i].type.split('/')[0] )
- {
- case 'flash': p = 3; break; // we'll rather have something else
-
- case 'mp4':
- case 'ogg': p = 8; break;
-
- case 'hls': p = 9; break; // hls html5 > other html5
-
- case 'ism':
- if( supports.ism_html5 )
- {
- p = 9;
- }else{
- p = 2; // ism is either not supported (in hasSupport), or will play over silverlight (and we rather not have that)
- }
- break;
-
- default: p = 0; break; // anything else (subtitle and json for example) are not videos
- }
-
- videos[i].priority = p;
- }
-
- // sort (in reverse; highest is [0], lowest is [len])
- videos.sort(function(a, b)
- {
- return b.priority - a.priority;
- });
- };
-
-
-
var video = mistvideo[streamname],
container = document.createElement('div'),
scripts = document.getElementsByTagName('script'),
@@ -241,8 +174,6 @@ function mistembed(streamname)
vtype = (video.type ? video.type : 'unknown'),
foundPlayer = false,
len = video.source.length;
-
- priority_sort( video.source );
for(i = 0; i < len; i++)
{