diff --git a/src/connectors/embed.js b/src/connectors/embed.js
index b2adba71..4b88f985 100644
--- a/src/connectors/embed.js
+++ b/src/connectors/embed.js
@@ -1,7 +1,7 @@
function mistembed(streamname)
{
// return the current flash version
- function flashVersion()
+ function flash_version()
{
var version = 0;
@@ -10,7 +10,6 @@ function mistembed(streamname)
// 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
@@ -20,10 +19,29 @@ function mistembed(streamname)
return parseInt(version, 10);
};
+ function html5_video_type(type)
+ {
+ var support = false;
+
+ try
+ {
+ var v = document.createElement('video');
+
+ if( v && v.canPlayType(type) != "" )
+ {
+ support = true;
+ }
+ }catch(e){}
+
+ return support;
+ }
+
// what does the browser support - used in hasSupport()
supports =
{
- flashversion: flashVersion()
+ flashversion: flash_version(),
+ hls: html5_video_type('application/vnd.apple.mpegURL'),
+ ism: html5_video_type('application/vnd.ms-ss')
};
// return true if a type is supported
@@ -35,12 +53,15 @@ function mistembed(streamname)
case 'rtmp': return supports.flashversion >= 10; break;
case 'flv': return supports.flashversion >= 7; break;
+ case 'hls': return supports.hls; break;
+ case 'ism': return supports.ism; break;
+
default: return false;
}
};
// build HTML for certain kinds of types
- function buildPlayer(src, container, videowidth, videoheight)
+ function buildPlayer(src, container, videowidth, videoheight, vtype)
{
// used to recalculate the width/height
var ratio;
@@ -65,14 +86,24 @@ function mistembed(streamname)
videoheight /= ratio;
}
+ // if the video type is 'live',
+ lappend = vtype == 'live' ? "&streamType=live" : "";
+
switch(src.type)
{
case 'f4v':
case 'rtmp':
case 'flv':
- container.innerHTML = '';
+ container.innerHTML = '';
break;
+
+ case 'hls':
+ case 'ism':
+ container.innerHTML = '';
+ break;
+
+
case 'fallback':
container.innerHTML = 'No support for any player found';
break;
@@ -105,7 +136,8 @@ function mistembed(streamname)
}else{
// no error, and sources found. Check the video types and output the best
// available video player.
- var i, video
+ var i, video,
+ vtype = video.type ? video.type : 'unknown';
foundPlayer = false,
len = video.source.length;
@@ -114,7 +146,7 @@ function mistembed(streamname)
if( hasSupport( video.source[i].type ) )
{
// we support this kind of video, so build it.
- buildPlayer(video.source[i], container.parentNode, video.width, video.height);
+ buildPlayer(video.source[i], container.parentNode, video.width, video.height, vtype);
// we've build a player, so we're done here
foundPlayer = true;