- ()error at required options
Embed
 - Dash and Flash demand a http stream source when the player is loaded over http
 - put mimetypes together when sorting sources
This commit is contained in:
Cat 2016-11-18 14:07:09 +01:00 committed by Thulinma
parent f00344f8ca
commit 6276485b66
6 changed files with 19 additions and 16 deletions

View file

@ -572,13 +572,10 @@ function mistPlay(streamName,options) {
//embedLog('Stream info contents: '+JSON.stringify(streaminfo));
streaminfo.initTime = new Date();
//sort the sources by priority, but prefer HTTPS
//sort the sources by priority and mime, but prefer HTTPS
streaminfo.source.sort(function(a,b){
function g(s) {
return s.priority + (s.url.indexOf('https://') > -1 ? 0.1 : 0)
}
return g(b) - g(a);
})
return (b.priority - a.priority) || a.type.localeCompare(b.type) || b.url.localeCompare(a.url);
});
var mistPlayer = false;
var source;
@ -625,7 +622,7 @@ function mistPlay(streamName,options) {
function checkMime(p_shortname,mime) {
for (var s in streaminfo.source) {
if (streaminfo.source[s].type == mime) {
if (mistplayers[p_shortname].isBrowserSupported(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);
streaminfo.working[p_shortname].push(mime);
if (!source) {
@ -666,7 +663,8 @@ function mistPlay(streamName,options) {
live: (streaminfo.type == 'live' ? true : false),
initTime: streaminfo.initTime,
meta: streaminfo.meta,
source: source
source: source,
host: options.host
};
//pass player options and handle defaults
playerOpts.autoplay = options.autoplay;

View file

@ -15,8 +15,8 @@
<script>
// global options can be set here
var mistoptions = {
//host: 'http://cat.mistserver.org:8080'
host: 'https://cat.mistserver.org:4433'
host: 'http://cat.mistserver.org:8080'
//host: 'https://cat.mistserver.org:4433'
};
</script>
@ -66,7 +66,7 @@
//tryplayers = Object.keys(mistplayers);
tryplayers = [];
tryplayers.push('html5');
//tryplayers.push('html5');
tryplayers.push('dashjs');
//tryplayers.push('flash_strobe');
//tryplayers.push('silverlight');
@ -85,6 +85,7 @@
mistPlay(streams[j],{
target: c,
forcePlayer: tryplayers[i],
//forceType: 'flash/7',
loop: true
});
}

View file

@ -5,7 +5,8 @@ mistplayers.dashjs = {
isMimeSupported: function (mimetype) {
return (this.mimes.indexOf(mimetype) == -1 ? false : true);
},
isBrowserSupported: function (mimetype) {
isBrowserSupported: function (mimetype,source,options) {
if ((options.host.substr(0,7) == 'http://') && (source.url.substr(0,8) == 'https://')) { return false; }
return (('dashjs' in window) && ('MediaSource' in window) && (location.protocol != 'file:'));
},
player: function(){}

View file

@ -5,7 +5,10 @@ mistplayers.flash_strobe = {
isMimeSupported: function (mimetype) {
return (this.mimes.indexOf(mimetype) == -1 ? false : true);
},
isBrowserSupported: function (mimetype) {
isBrowserSupported: function (mimetype,source,options) {
//check for http / https crossovers
if ((options.host.substr(0,7) == 'http://') && (source.url.substr(0,8) == 'https://')) { return false; }
var version = 0;
try {
// check in the mimeTypes
@ -38,7 +41,7 @@ p.prototype.build = function (options) {
ele.setAttribute('width',options.width);
ele.setAttribute('height',options.height);
ele.appendChild(createParam('movie',options.source.player_url));
ele.appendChild(createParam('movie',options.host+options.source.player_url));
var flashvars = 'src='+encodeURIComponent(options.src)+'&controlBarMode='+(options.controls ? 'floating' : 'none')+'&initialBufferTime=0.5&expandedBufferTime=5&minContinuousPlaybackTime=3'+(options.live ? '&streamType=live' : '')+(options.autoplay ? '&autoPlay=true' : '' );
ele.appendChild(createParam('flashvars',flashvars));
ele.appendChild(createParam('allowFullScreen','true'));