LSP
- Preview: Use source select box actually forces a source, not a mime type Embed - added forceSource option - player error messages clear the container html before appending
This commit is contained in:
parent
6276485b66
commit
7b96407e9b
5 changed files with 67 additions and 14 deletions
|
@ -584,6 +584,12 @@ function mistPlay(streamName,options) {
|
|||
embedLog('Forcing '+options.forceType);
|
||||
forceType = options.forceType;
|
||||
}
|
||||
var forceSource = false;
|
||||
if (('forceSource' in options) && (options.forceSource)) {
|
||||
forceSource = options.forceSource;
|
||||
forceType = streaminfo.source[forceSource].type;
|
||||
embedLog('Forcing source '+options.forceSource+': '+forceType+' @ '+streaminfo.source[forceSource].url);
|
||||
}
|
||||
var forceSupportCheck = false;
|
||||
if (('forceSupportCheck' in options) && (options.forceSupportCheck)) {
|
||||
embedLog('Forcing a full support check');
|
||||
|
@ -620,14 +626,21 @@ function mistPlay(streamName,options) {
|
|||
return false;
|
||||
}
|
||||
function checkMime(p_shortname,mime) {
|
||||
for (var s in streaminfo.source) {
|
||||
if (streaminfo.source[s].type == mime) {
|
||||
if (mistplayers[p_shortname].isBrowserSupported(mime,streaminfo.source[s],options)) {
|
||||
embedLog('Found a working combo: '+mistplayers[p_shortname].name+' with '+mime+' @ '+streaminfo.source[s].url);
|
||||
var loop;
|
||||
if (forceSource) {
|
||||
loop = [streaminfo.source[forceSource]];
|
||||
}
|
||||
else {
|
||||
loop = streaminfo.source;
|
||||
}
|
||||
for (var s in loop) {
|
||||
if (loop[s].type == mime) {
|
||||
if (mistplayers[p_shortname].isBrowserSupported(mime,loop[s],options)) {
|
||||
embedLog('Found a working combo: '+mistplayers[p_shortname].name+' with '+mime+' @ '+loop[s].url);
|
||||
streaminfo.working[p_shortname].push(mime);
|
||||
if (!source) {
|
||||
mistPlayer = p_shortname;
|
||||
source = streaminfo.source[s];
|
||||
source = loop[s];
|
||||
}
|
||||
if (!forceSupportCheck) {
|
||||
return source;
|
||||
|
@ -656,6 +669,7 @@ function mistPlay(streamName,options) {
|
|||
}
|
||||
}
|
||||
|
||||
options.target.innerHTML = '';
|
||||
if (mistPlayer) {
|
||||
//create the options to send to the player
|
||||
var playerOpts = {
|
||||
|
@ -785,7 +799,6 @@ function mistPlay(streamName,options) {
|
|||
//build the player
|
||||
player.options = playerOpts;
|
||||
var element = player.build(playerOpts);
|
||||
options.target.innerHTML = '';
|
||||
options.target.appendChild(element);
|
||||
element.setAttribute('data-player',mistPlayer);
|
||||
element.setAttribute('data-mime',source.type);
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
</script>
|
||||
|
||||
<script src=core.js></script>
|
||||
<script src=wrappers/theoplayer.js></script>
|
||||
<script src=wrappers/jwplayer.js></script>
|
||||
<!--<script src=wrappers/theoplayer.js></script>-->
|
||||
<!--<script src=wrappers/jwplayer.js></script>-->
|
||||
<script src=wrappers/html5.js></script>
|
||||
<script src=wrappers/dashjs.js></script>
|
||||
<script src=wrappers/flash_strobe.js></script>
|
||||
|
@ -86,6 +86,7 @@
|
|||
target: c,
|
||||
forcePlayer: tryplayers[i],
|
||||
//forceType: 'flash/7',
|
||||
//forceSource: 5,
|
||||
loop: true
|
||||
});
|
||||
}
|
||||
|
|
|
@ -144,7 +144,46 @@ p.prototype.build = function (options,callback) {
|
|||
|
||||
//forward events
|
||||
ele.addEventListener('error',function(e){
|
||||
me.adderror(e.message);
|
||||
var msg;
|
||||
if ('message' in e) {
|
||||
msg = e.message;
|
||||
}
|
||||
else {
|
||||
msg = 'readyState: ';
|
||||
switch (me.element.readyState) {
|
||||
case 0:
|
||||
msg += 'HAVE_NOTHING';
|
||||
break;
|
||||
case 1:
|
||||
msg += 'HAVE_METADATA';
|
||||
break;
|
||||
case 2:
|
||||
msg += 'HAVE_CURRENT_DATA';
|
||||
break;
|
||||
case 3:
|
||||
msg += 'HAVE_FUTURE_DATA';
|
||||
break;
|
||||
case 4:
|
||||
msg += 'HAVE_ENOUGH_DATA';
|
||||
break;
|
||||
}
|
||||
msg += ' networkState: ';
|
||||
switch (me.element.networkState) {
|
||||
case 0:
|
||||
msg += 'NETWORK_EMPTY';
|
||||
break;
|
||||
case 1:
|
||||
msg += 'NETWORK_IDLE';
|
||||
break;
|
||||
case 2:
|
||||
msg += 'NETWORK_LOADING';
|
||||
break;
|
||||
case 3:
|
||||
msg += 'NETWORK_NO_SOURCE';
|
||||
break;
|
||||
}
|
||||
}
|
||||
me.adderror(msg);
|
||||
},true);
|
||||
var events = ['abort','canplay','canplaythrough','durationchange','emptied','ended','interruptbegin','interruptend','loadeddata','loadedmetadata','loadstart','pause','play','playing','ratechange','seeked','seeking','stalled','volumechange','waiting'];
|
||||
for (var i in events) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue