LSP
- ()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:
parent
f00344f8ca
commit
6276485b66
6 changed files with 19 additions and 16 deletions
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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(){}
|
||||
|
|
|
@ -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'));
|
||||
|
|
|
@ -194,7 +194,7 @@ true;UI.elements.connection.status.text("Connected").removeClass("red").addClass
|
|||
c.data[f][q]]);if(j){d();j--}}if(mist.data.config.time-c.end>20){d();k=(mist.data.config.time-15)*1E3;d()}}else{k=(mist.data.config.time-600)*1E3;d();k=(mist.data.config.time-15)*1E3;d()}d=e;stream=a?a.join(" "):"all_streams";protocol=b?b.join("_"):"all_protocols";stream in mist.data.totals||(mist.data.totals[stream]={});protocol in mist.data.totals[stream]||(mist.data.totals[stream][protocol]={});$.extend(mist.data.totals[stream][protocol],d)};mist.data.totals={};if("fields"in d.totals)e(b.totals.streams,
|
||||
b.totals.protocols,d.totals);else for(q in d.totals)e(b.totals[q].streams,b.totals[q].protocols,d.totals[q])}a&&a(d,c);break;case "CHALL":if(d.authorize.challenge==mist.user.authstring){mist.user.password!=""&&UI.elements.connection.msg.text("The credentials you provided are incorrect.").addClass("red");UI.navto("Login")}else if(mist.user.password=="")UI.navto("Login");else{mist.user.authstring=d.authorize.challenge;mist.send(a,b,c);sessionStorage.setItem("mistLogin",JSON.stringify({host:mist.user.host,
|
||||
name:mist.user.name,password:mist.user.password}))}break;case "NOACC":UI.navto("Create a new account");break;case "ACC_MADE":delete b.authorize;mist.send(a,b,c);break;default:UI.navto("Login")}}};c.hide||UI.elements.connection.msg.removeClass("red").text("Data sent, waiting for a reply..").append($("<br>")).append($("<a>").text("Cancel request").click(function(){e.abort()}));var e=$.ajax(d)},inputMatch:function(a,b){if(typeof a=="undefined")return false;typeof a=="string"&&(a=[a]);for(var c in a){var d=
|
||||
a[c].replace(/[^\w\s]/g,"\\$&"),d=d.replace(/\\\?/g,".").replace(/\\\*/g,"(?:.)*");if(RegExp("^(?:[a-zA-Z]:)?"+d+"$","i").test(b))return true}return false},convertBuildOptions:function(a,b){var c=[],d=["required","optional"];"desc"in a&&c.push({type:"help",help:a.desc});for(var e in d)if(a[d[e]]){c.push($("<h4>").text(UI.format.capital(d[e])+" parameters"));for(var k in a[d[e]]){var m=a[d[e]][k],f={label:UI.format.capital(m.name),pointer:{main:b,index:k},validate:[]};(d[e]=="required"&&!("default"in
|
||||
a[c].replace(/[^\w\s]/g,"\\$&"),d=d.replace(/\\\?/g,".").replace(/\\\*/g,"(?:.)*");if(RegExp("^(?:[a-zA-Z]:)?"+d+"$","i").test(b))return true}return false},convertBuildOptions:function(a,b){var c=[],d=["required","optional"];"desc"in a&&c.push({type:"help",help:a.desc});for(var e in d)if(a[d[e]]){c.push($("<h4>").text(UI.format.capital(d[e])+" parameters"));for(var k in a[d[e]]){var m=a[d[e]][k],f={label:UI.format.capital(m.name),pointer:{main:b,index:k},validate:[]};d[e]=="required"&&(!("default"in
|
||||
m)||m["default"]=="")&&f.validate.push("required");if("default"in m)f.placeholder=m["default"];if("help"in m)f.help=m.help;if("unit"in m)f.unit=m.unit;switch(m.type){case "int":f.type="int";break;case "uint":f.type="int";f.min=0;break;case "debug":f.type="debug";break;case "select":f.type="select";f.select=m.select;break;default:f.type="str"}c.push(f)}}return c},stored:{get:function(){return mist.data.ui_settings||{}},set:function(a,b){var c=this.get();c[a]=b;mist.send(function(){},{ui_settings:c})},
|
||||
del:function(a){delete mist.data.ui_settings[a];mist.send(function(){},{ui_settings:mist.data.ui_settings})}}};function log(){try{UI.debug&&[].push.call(arguments,Error().stack);[].unshift.call(arguments,"["+UI.format.time((new Date).getTime()/1E3)+"]");console.log.apply(console,arguments)}catch(a){}}
|
||||
$.fn.getval=function(){var a=$(this).data("opts"),b=$(this).val();if(a&&"type"in a)switch(a.type){case "span":b=$(this).html();break;case "checkbox":b=$(this).prop("checked");break;case "radioselect":a=$(this).find("label > input[type=radio]:checked").parent();if(a.length){b=[];b.push(a.children("input[type=radio]").val());a=a.children("select");a.length&&b.push(a.val())}else b="";break;case "checklist":b=[];$(this).find(".checklist input[type=checkbox]:checked").each(function(){b.push($(this).attr("name"))})}return b};
|
||||
|
|
|
@ -5575,7 +5575,7 @@ var mist = {
|
|||
},
|
||||
validate: []
|
||||
};
|
||||
if ((type[j] == 'required') && (!('default' in ele)) || (ele['default'] == '')) {
|
||||
if ((type[j] == 'required') && ((!('default' in ele)) || (ele['default'] == ''))) {
|
||||
obj.validate.push('required');
|
||||
}
|
||||
if ('default' in ele) {
|
||||
|
|
Loading…
Add table
Reference in a new issue