LSP - bad code, bad! no overwriting my streams object with null :(
This commit is contained in:
parent
0b784a3d53
commit
2a7a714aad
2 changed files with 15 additions and 15 deletions
|
@ -92,24 +92,24 @@ UI.format.status(e),k=$("<button>").text("Preview").click(function(){UI.navto("P
|
||||||
a++}},{totals:a,active_streams:true})},x=$.extend(!0,{},mist.data.streams),R=function(a,b){var c=$.extend({},b);delete c.meta;delete c.error;c.online=2;c.name=a;c.ischild=true;return c};if(mist.data.LTS){var A=0,E=0;for(i in mist.data.streams)q=mist.data.capabilities.inputs.Folder||mist.data.capabilities.inputs["Folder.exe"],mist.inputMatch(q.source_match,mist.data.streams[i].source)&&(x[i].source+="*",mist.send(function(a,b){var c=b.stream,d;for(d in a.browse.files)for(var e in mist.data.capabilities.inputs)if(!(e.indexOf("Buffer")>=
|
a++}},{totals:a,active_streams:true})},x=$.extend(!0,{},mist.data.streams),R=function(a,b){var c=$.extend({},b);delete c.meta;delete c.error;c.online=2;c.name=a;c.ischild=true;return c};if(mist.data.LTS){var A=0,E=0;for(i in mist.data.streams)q=mist.data.capabilities.inputs.Folder||mist.data.capabilities.inputs["Folder.exe"],mist.inputMatch(q.source_match,mist.data.streams[i].source)&&(x[i].source+="*",mist.send(function(a,b){var c=b.stream,d;for(d in a.browse.files)for(var e in mist.data.capabilities.inputs)if(!(e.indexOf("Buffer")>=
|
||||||
0||e.indexOf("Folder")>=0)&&mist.inputMatch(mist.data.capabilities.inputs[e].source_match,"/"+a.browse.files[d])){var f=c+"+"+a.browse.files[d];x[f]=R(f,mist.data.streams[c]);x[f].source=mist.data.streams[c].source+a.browse.files[d]}a.browse.files.length?x[c].filesfound=true:mist.data.streams[c].filesfound=false;E++;if(A==E){mist.send(function(){D()},{active_streams:true});UI.interval.set(function(){D()},1E4)}},{browse:mist.data.streams[i].source},{stream:i}),A++);0==A&&(mist.send(function(){D()},
|
0||e.indexOf("Folder")>=0)&&mist.inputMatch(mist.data.capabilities.inputs[e].source_match,"/"+a.browse.files[d])){var f=c+"+"+a.browse.files[d];x[f]=R(f,mist.data.streams[c]);x[f].source=mist.data.streams[c].source+a.browse.files[d]}a.browse.files.length?x[c].filesfound=true:mist.data.streams[c].filesfound=false;E++;if(A==E){mist.send(function(){D()},{active_streams:true});UI.interval.set(function(){D()},1E4)}},{browse:mist.data.streams[i].source},{stream:i}),A++);0==A&&(mist.send(function(){D()},
|
||||||
{active_streams:!0}),UI.interval.set(function(){D()},3E4))}else mist.send(function(){D()},{active_streams:!0}),UI.interval.set(function(){D()},1E4);break;case "Edit Stream":if("undefined"==typeof mist.data.capabilities){mist.send(function(){UI.navto(a,c)},{capabilities:!0});b.append("Loading..");break}j=!1;""!=c&&(j=!0);j?(q=c,n=mist.data.streams[q],b.find("h2").append(' "'+q+'"')):(b.html($("<h2>").text("New Stream")),n={});i=[];for(r in mist.data.capabilities.inputs)i.push(mist.data.capabilities.inputs[r].source_match);
|
{active_streams:!0}),UI.interval.set(function(){D()},3E4))}else mist.send(function(){D()},{active_streams:!0}),UI.interval.set(function(){D()},1E4);break;case "Edit Stream":if("undefined"==typeof mist.data.capabilities){mist.send(function(){UI.navto(a,c)},{capabilities:!0});b.append("Loading..");break}j=!1;""!=c&&(j=!0);j?(q=c,n=mist.data.streams[q],b.find("h2").append(' "'+q+'"')):(b.html($("<h2>").text("New Stream")),n={});i=[];for(r in mist.data.capabilities.inputs)i.push(mist.data.capabilities.inputs[r].source_match);
|
||||||
var F=$("<div>");b.append(UI.buildUI([{label:"Stream name",type:"str",validate:["required","streamname"],pointer:{main:n,index:"name"},help:"Set the name this stream will be recognised by for players and/or stream pushing."},{label:"Source",type:"browse",validate:["required"],filetypes:i,pointer:{main:n,index:"source"},help:'Set the stream source.<table><tr><td>VoD:</td><td>You can browse to the file or folder as a source or simply enter the path to the file.</td></tr><tr><td>Live:</td><td>You\'ll need to enter "push://IP" with the IP of the machine pushing towards MistServer.<br>You can use "push://" to accept any source.</td></tr><tr><td>(Pro only)</td><td>Use "push://(IP)@password" to set a password protection for pushes.</td></tr></table>If you\'re unsure how to set the source properly, please view our Live pushing guide at the tools section.',
|
var G=$("<div>");b.append(UI.buildUI([{label:"Stream name",type:"str",validate:["required","streamname"],pointer:{main:n,index:"name"},help:"Set the name this stream will be recognised by for players and/or stream pushing."},{label:"Source",type:"browse",validate:["required"],filetypes:i,pointer:{main:n,index:"source"},help:'Set the stream source.<table><tr><td>VoD:</td><td>You can browse to the file or folder as a source or simply enter the path to the file.</td></tr><tr><td>Live:</td><td>You\'ll need to enter "push://IP" with the IP of the machine pushing towards MistServer.<br>You can use "push://" to accept any source.</td></tr><tr><td>(Pro only)</td><td>Use "push://(IP)@password" to set a password protection for pushes.</td></tr></table>If you\'re unsure how to set the source properly, please view our Live pushing guide at the tools section.',
|
||||||
"function":function(){var a=$(this).val();if(a!=""){var b=null,c;for(c in mist.data.capabilities.inputs)if(typeof mist.data.capabilities.inputs[c].source_match!="undefined"&&mist.inputMatch(mist.data.capabilities.inputs[c].source_match,a)){b=c;break}if(b===null)F.html($("<h3>").text("Unrecognized input").addClass("red")).append($("<span>").text("Please edit the stream source.").addClass("red"));else{a=mist.data.capabilities.inputs[b];F.html($("<h3>").text(a.name+" Input options"));a=mist.convertBuildOptions(a,
|
"function":function(){var a=$(this).val();if(a!=""){var b=null,c;for(c in mist.data.capabilities.inputs)if(typeof mist.data.capabilities.inputs[c].source_match!="undefined"&&mist.inputMatch(mist.data.capabilities.inputs[c].source_match,a)){b=c;break}if(b===null)G.html($("<h3>").text("Unrecognized input").addClass("red")).append($("<span>").text("Please edit the stream source.").addClass("red"));else{a=mist.data.capabilities.inputs[b];G.html($("<h3>").text(a.name+" Input options"));a=mist.convertBuildOptions(a,
|
||||||
n);F.append(UI.buildUI(a))}}}},$("<br>"),{type:"custom",custom:F},$("<br>"),$("<h3>").text("Encryption"),{type:"help",help:"To enable encryption, the licence acquisition url must be entered, as well as either the content key or the key ID and seed.<br>Unsure how you should fill in your encryption or missing your preferred encryption? Please contact us."},{label:"License acquisition url",type:"str",LTSonly:!0,pointer:{main:n,index:"la_url"}},$("<br>"),{label:"Content key",type:"str",LTSonly:!0,pointer:{main:n,
|
n);G.append(UI.buildUI(a))}}}},$("<br>"),{type:"custom",custom:G},$("<br>"),$("<h3>").text("Encryption"),{type:"help",help:"To enable encryption, the licence acquisition url must be entered, as well as either the content key or the key ID and seed.<br>Unsure how you should fill in your encryption or missing your preferred encryption? Please contact us."},{label:"License acquisition url",type:"str",LTSonly:!0,pointer:{main:n,index:"la_url"}},$("<br>"),{label:"Content key",type:"str",LTSonly:!0,pointer:{main:n,
|
||||||
index:"contentkey"}},{type:"text",text:" - or - "},{label:"Key ID",type:"str",LTSonly:!0,pointer:{main:n,index:"keyid"}},{label:"Key seed",type:"str",LTSonly:!0,pointer:{main:n,index:"keyseed"}},{type:"buttons",buttons:[{type:"cancel",label:"Cancel","function":function(){UI.navto("Streams")}},{type:"save",label:"Save","function":function(){if(!mist.data.streams)mist.data.streams={};mist.data.streams[n.name]=n;c!=n.name&&delete mist.data.streams[c];var a={};if(mist.data.LTS){a.addstream={};a.addstream[n.name]=
|
index:"contentkey"}},{type:"text",text:" - or - "},{label:"Key ID",type:"str",LTSonly:!0,pointer:{main:n,index:"keyid"}},{label:"Key seed",type:"str",LTSonly:!0,pointer:{main:n,index:"keyseed"}},{type:"buttons",buttons:[{type:"cancel",label:"Cancel","function":function(){UI.navto("Streams")}},{type:"save",label:"Save","function":function(){if(!mist.data.streams)mist.data.streams={};mist.data.streams[n.name]=n;c!=n.name&&delete mist.data.streams[c];var a={};if(mist.data.LTS){a.addstream={};a.addstream[n.name]=
|
||||||
n;if(c!=n.name)a.deletestream=[c]}else a.streams=mist.data.streams;mist.send(function(){delete mist.data.streams[n.name].online;delete mist.data.streams[n.name].error;UI.navto("Streams")},a)}}]}]));j&&(i={streams:{}},i.streams[q]=mist.data.streams[q].limits,b.append($("<h3>").text("Limits")).append(UI.buildLimits(i,a,c)));break;case "Preview":if(""==c){b.append("Loading..");var I=function(c){var d={};c.sort();b.html($("<h2>").text(a)).append(UI.buildUI([{label:"Select a stream",type:"select",select:c,
|
n;if(c!=n.name)a.deletestream=[c]}else a.streams=mist.data.streams;mist.send(function(){delete mist.data.streams[n.name].online;delete mist.data.streams[n.name].error;UI.navto("Streams")},a)}}]}]));j&&(i={streams:{}},i.streams[q]=mist.data.streams[q].limits,b.append($("<h3>").text("Limits")).append(UI.buildLimits(i,a,c)));break;case "Preview":if(""==c){b.append("Loading..");var I=function(c){var d={};c.sort();b.html($("<h2>").text(a)).append(UI.buildUI([{label:"Select a stream",type:"select",select:c,
|
||||||
pointer:{main:d,index:"stream"}},{type:"buttons",buttons:[{type:"save",label:"Go","function":function(){UI.navto(a,d.stream)}}]}]));UI.elements.secondary_menu.html("").append($("<a>").addClass("button").addClass("active").text("Choose stream").click(function(){UI.navto("Preview")}));var e=$("<div>").addClass("preview_icons");b.append($("<span>").addClass("description").text("Or, click a stream from the list below.")).append(e);for(var f in c){var g=c[f],h="";if(g.indexOf("+")>-1){h=g.split("+");h=
|
pointer:{main:d,index:"stream"}},{type:"buttons",buttons:[{type:"save",label:"Go","function":function(){UI.navto(a,d.stream)}}]}]));UI.elements.secondary_menu.html("").append($("<a>").addClass("button").addClass("active").text("Choose stream").click(function(){UI.navto("Preview")}));var e=$("<div>").addClass("preview_icons");b.append($("<span>").addClass("description").text("Or, click a stream from the list below.")).append(e);for(var f in c){var g=c[f],h="";if(g.indexOf("+")>-1){h=g.split("+");h=
|
||||||
mist.data.streams[h[0]].source+h[1]}else h=mist.data.streams[g].source;e.append($("<button>").append($("<span>").text(g)).append($("<span>").addClass("description").text(h)).attr("title",g).attr("data-stream",g).click(function(){UI.navto("Preview",$(this).attr("data-stream"))}))}};if(mist.data.LTS){if("undefined"==typeof mist.data.capabilities){mist.send(function(){UI.navto(a,c)},{capabilities:!0});b.append("Loading..");break}E=A=0;t={};for(i in mist.data.streams)q=mist.data.capabilities.inputs.Folder||
|
mist.data.streams[h[0]].source+h[1]}else h=mist.data.streams[g].source;e.append($("<button>").append($("<span>").text(g)).append($("<span>").addClass("description").text(h)).attr("title",g).attr("data-stream",g).click(function(){UI.navto("Preview",$(this).attr("data-stream"))}))}};if(mist.data.LTS){if("undefined"==typeof mist.data.capabilities){mist.send(function(){UI.navto(a,c)},{capabilities:!0});b.append("Loading..");break}E=A=0;t={};for(i in mist.data.streams)q=mist.data.capabilities.inputs.Folder||
|
||||||
mist.data.capabilities.inputs["Folder.exe"],mist.inputMatch(q.source_match,mist.data.streams[i].source)&&(mist.send(function(a,b){var c=b.stream,d;for(d in mist.data.browse.files)for(var e in mist.data.capabilities.inputs)e.indexOf("Buffer")>=0||e.indexOf("Folder")>=0||mist.inputMatch(mist.data.capabilities.inputs[e].source_match,"/"+mist.data.browse.files[d])&&(t[c+"+"+mist.data.browse.files[d]]=true);E++;A==E&&mist.send(function(){for(var a in mist.data.active_streams){var b=mist.data.active_streams[a].split("+");
|
mist.data.capabilities.inputs["Folder.exe"],mist.inputMatch(q.source_match,mist.data.streams[i].source)&&(mist.send(function(a,b){var c=b.stream,d;for(d in mist.data.browse.files)for(var e in mist.data.capabilities.inputs)e.indexOf("Buffer")>=0||e.indexOf("Folder")>=0||mist.inputMatch(mist.data.capabilities.inputs[e].source_match,"/"+mist.data.browse.files[d])&&(t[c+"+"+mist.data.browse.files[d]]=true);E++;A==E&&mist.send(function(){for(var a in mist.data.active_streams){var b=mist.data.active_streams[a].split("+");
|
||||||
b.length>1&&b[0]in mist.data.streams&&(t[mist.data.active_streams[a]]=true)}t=Object.keys(t);t=t.concat(Object.keys(mist.data.streams));t.sort();I(t)},{active_streams:true})},{browse:mist.data.streams[i].source},{stream:i}),A++);0==A&&mist.send(function(){var c=[],d;for(d in mist.data.active_streams){var e=mist.data.active_streams[d].split("+");e.length>1&&e[0]in mist.data.streams&&(c[mist.data.active_streams[d]]=true)}mist.data.streams&&(c=c.concat(Object.keys(mist.data.streams)));if(c.length==0)b.html($("<h2>").text(a)).append("Please set up a stream first.");
|
b.length>1&&b[0]in mist.data.streams&&(t[mist.data.active_streams[a]]=true)}t=Object.keys(t);t=t.concat(Object.keys(mist.data.streams));t.sort();I(t)},{active_streams:true})},{browse:mist.data.streams[i].source},{stream:i}),A++);0==A&&mist.send(function(){var c=[],d;for(d in mist.data.active_streams){var e=mist.data.active_streams[d].split("+");e.length>1&&e[0]in mist.data.streams&&(c[mist.data.active_streams[d]]=true)}mist.data.streams&&(c=c.concat(Object.keys(mist.data.streams)));if(c.length==0)b.html($("<h2>").text(a)).append("Please set up a stream first.");
|
||||||
else{c.sort();I(c)}},{active_streams:!0})}else I(Object.keys(mist.data.streams));break}b.find("h2").append(' of "'+c+'"');i=":8080";for(r in mist.data.config.protocols)if(q=mist.data.config.protocols[r],"HTTP"==q.connector||"HTTP.exe"==q.connector)i=q.port?":"+q.port:":8080";var B={},q=$("<span>").hide();B["Embed urls"]=q;b.append(q);var w="",d=mist.user.host.match(/(https?)\:\/\/([^:\/]+)\:(\d+)?/i);null!=d&&(w=d[2]);var G="http://"+w+i+"/",C={},J=function(a){var b=["div"],d='\n <script src="'+
|
else{c.sort();I(c)}},{active_streams:!0})}else I(Object.keys(mist.data.streams));break}b.find("h2").append(' of "'+c+'"');i=":8080";for(r in mist.data.config.protocols)if(q=mist.data.config.protocols[r],"HTTP"==q.connector||"HTTP.exe"==q.connector)i=q.port?":"+q.port:":8080";var B={},q=$("<span>").hide();B["Embed urls"]=q;b.append(q);var w="",d=mist.user.host.match(/(https?)\:\/\/([^:\/]+)\:(\d+)?/i);null!=d&&(w=d[2]);var F="http://"+w+i+"/",C={},J=function(a){var b=["div"],d='\n <script src="'+
|
||||||
G+"embed_"+c+'.js"><\/script>\n';a.autoplay&&b.push("data-autoplay");a.forceprotocol&&a.forceprotocol!=""&&b.push('data-forcetype="'+a.forceprotocol+'"');return"<"+b.join(" ")+">"+d+"</div>"},S=$("<span>");q.append($("<h3>").text("Embed urls")).append(UI.buildUI([{label:"Embed url",type:"str",value:G+"embed_"+c+".js",readonly:!0,qrcode:!0},{label:"Info url",type:"str",value:G+"info_"+c+".js",qrcode:!0,readonly:!0},$("<h3>").text("Embed code"),{label:"Embed code",type:"textarea",value:J(C),rows:4,
|
F+"embed_"+c+'.js"><\/script>\n';a.autoplay&&b.push("data-autoplay");a.forceprotocol&&a.forceprotocol!=""&&b.push('data-forcetype="'+a.forceprotocol+'"');return"<"+b.join(" ")+">"+d+"</div>"},S=$("<span>");q.append($("<h3>").text("Embed urls")).append(UI.buildUI([{label:"Embedable script",type:"str",value:F+"embed_"+c+".js",readonly:!0},{label:"Stream info script",type:"str",value:F+"info_"+c+".js",readonly:!0},{label:"Autodetect player",type:"str",value:F+c+".html",readonly:!0,qrcode:!0},$("<h3>").text("Embed code"),
|
||||||
readonly:!0,classes:["embed_code"]},$("<h4>").text("Embed code options").css("margin-top",0),{label:"Autoplay",type:"checkbox",pointer:{main:C,index:"autoplay"},"function":function(){C.autoplay=$(this).getval();$(".embed_code").setval(J(C))}},{label:"Force protocol",type:"select",select:[["","Automatic"]],pointer:{main:C,index:"protocol"},classes:["embed_code_forceprotocol"],"function":function(){C.forceprotocol=$(this).getval();$(".embed_code").setval(J(C))}},$("<h3>").text("Protocol stream urls"),
|
{label:"Embed code",type:"textarea",value:J(C),rows:4,readonly:!0,classes:["embed_code"]},$("<h4>").text("Embed code options").css("margin-top",0),{label:"Autoplay",type:"checkbox",pointer:{main:C,index:"autoplay"},"function":function(){C.autoplay=$(this).getval();$(".embed_code").setval(J(C))}},{label:"Force protocol",type:"select",select:[["","Automatic"]],pointer:{main:C,index:"protocol"},classes:["embed_code_forceprotocol"],"function":function(){C.forceprotocol=$(this).getval();$(".embed_code").setval(J(C))}},
|
||||||
S]));i=$("<span>").append($("<h3>").text("Meta information")).hide();B["Meta information"]=i;var K=$("<span>");i.append(K);b.append(i);i=$("<span>").hide();B.Preview=i;b.append(i);var y=$("<div>").css("float","left").css("margin-right","1em").attr("data-forcesupportcheck",""),T=$("<div>").css("float","left");i.append(y).append(T);mist.stored.get().autoplay&&y.attr("data-autoplay","");var H=function(){y.text("Loading..");var a=document.createElement("script");a.src=G+"embed_"+c+".js";a.onerror=function(){y.html('Error loading "'+
|
$("<h3>").text("Protocol stream urls"),S]));i=$("<span>").append($("<h3>").text("Meta information")).hide();B["Meta information"]=i;var K=$("<span>");i.append(K);b.append(i);i=$("<span>").hide();B.Preview=i;b.append(i);var y=$("<div>").css("float","left").css("margin-right","1em").attr("data-forcesupportcheck",""),T=$("<div>").css("float","left");i.append(y).append(T);mist.stored.get().autoplay&&y.attr("data-autoplay","");var H=function(){y.text("Loading..");var a=document.createElement("script");
|
||||||
a.src+'".<br>').append($("<button>").text("Try again").click(function(){H()}))};a.onload=function(){if(typeof mistvideo[c].error!="undefined")y.html(mistvideo[c].error+"<br>").append($("<button>").text("Try again").click(function(){H()}));else{var a=mistvideo[c],b=UI.buildUI([{label:"Protocol stream url",type:"str",readonly:true,value:a.embedded?a.embedded.url:"",qrcode:true},{label:"Autoplay (from now on)",type:"checkbox",value:mist.stored.get().autoplay,"function":function(){mist.stored.set("autoplay",
|
a.src=F+"embed_"+c+".js";a.onerror=function(){y.html('Error loading "'+a.src+'".<br>').append($("<button>").text("Try again").click(function(){H()}))};a.onload=function(){if(typeof mistvideo[c].error!="undefined")y.html(mistvideo[c].error+"<br>").append($("<button>").text("Try again").click(function(){H()}));else{var a=mistvideo[c],b=UI.buildUI([{label:"Protocol stream url",type:"str",readonly:true,value:a.embedded?a.embedded.url:"",qrcode:true},{label:"Autoplay (from now on)",type:"checkbox",value:mist.stored.get().autoplay,
|
||||||
$(this).getval()?1:0)}}]);b.find(".help_container").remove();y.append(b);var d=$("<table>").css("font-size","0.9em").html($("<thead>").html($("<tr>").html($("<th>")).append($("<th>").text("Type")).append($("<th>").text("Priority")).append($("<th>").text("Simul. tracks")).append($("<th>").html("Your browser<br>support"))));T.html(d);b=$("<tbody>");d.append(b);var d=$(".embed_code_forceprotocol"),e=[];d.find(".clear").remove();for(var f in a.source){var g=a.source[f],h=g.type.split("/"),i=h[0];i.length<
|
"function":function(){mist.stored.set("autoplay",$(this).getval()?1:0)}}]);b.find(".help_container").remove();y.append(b);var d=$("<table>").css("font-size","0.9em").html($("<thead>").html($("<tr>").html($("<th>")).append($("<th>").text("Type")).append($("<th>").text("Priority")).append($("<th>").text("Simul. tracks")).append($("<th>").html("Your browser<br>support"))));T.html(d);b=$("<tbody>");d.append(b);var d=$(".embed_code_forceprotocol"),e=[];d.find(".clear").remove();for(var f in a.source){var g=
|
||||||
6&&(i=i.toUpperCase());switch(h.length){case 1:break;case 2:i=UI.format.capital(h[0])+" v"+h[1];if(h[0]=="flash")switch(h[1]){case "7":i="Progressive ("+i+")";break;case "10":i="RTMP ("+i+")";break;case "11":i="HDS ("+i+")"}break;case 3:switch(h[2]){case "vnd.apple.mpegurl":i=i+" HLS";break;case "vnd.ms-ss":i=i+" Smooth";break;case "mp2t":i=i+" TS";break;default:h[2].length<6&&(h[2]=h[2].toUpperCase());i=i+(" "+h[2]);h[1]!="video"&&(i=i+(" ("+h[1]+")"))}break;default:i=g.type}i=UI.format.capital(i);
|
a.source[f],h=g.type.split("/"),i=h[0];i.length<6&&(i=i.toUpperCase());switch(h.length){case 1:break;case 2:i=UI.format.capital(h[0])+" v"+h[1];if(h[0]=="flash")switch(h[1]){case "7":i="Progressive ("+i+")";break;case "10":i="RTMP ("+i+")";break;case "11":i="HDS ("+i+")"}break;case 3:switch(h[2]){case "vnd.apple.mpegurl":i=i+" HLS";break;case "vnd.ms-ss":i=i+" Smooth";break;case "mp2t":i=i+" TS";break;default:h[2].length<6&&(h[2]=h[2].toUpperCase());i=i+(" "+h[2]);h[1]!="video"&&(i=i+(" ("+h[1]+")"))}break;
|
||||||
d.append($("<option>").text(i).val(g.type).addClass("clear"));e.push({label:i,type:"str",value:g.url,readonly:true,qrcode:true});h=$("<tr>");b.append(h);h.html($("<td>").html($("<input>").attr("type","radio").attr("name","protocolforce").change(function(){y.attr("data-forcetype",$(this).val()).html("Loading embed..");H()}).val(g.type))).append($("<td>").text(i)).append($("<td>").text(g.priority)).append($("<td>").text(g.simul_tracks+"/"+g.total_matches)).append($("<td>").text(g.browser_support?"yes":
|
default:i=g.type}i=UI.format.capital(i);d.append($("<option>").text(i).val(g.type).addClass("clear"));e.push({label:i,type:"str",value:g.url,readonly:true,qrcode:true});h=$("<tr>");b.append(h);h.html($("<td>").html($("<input>").attr("type","radio").attr("name","protocolforce").change(function(){y.attr("data-forcetype",$(this).val()).html("Loading embed..");H()}).val(g.type))).append($("<td>").text(i)).append($("<td>").text(g.priority)).append($("<td>").text(g.simul_tracks+"/"+g.total_matches)).append($("<td>").text(g.browser_support?
|
||||||
"no"));if(a.embedded&&a.embedded.type==g.type){h.css("outline","1px solid rgba(0,0,0,0.5)");h.find("input[type=radio]").prop("checked",true)}}S.html(UI.buildUI(e));var j;if(c in mistvideo)j=mistvideo[c].meta;if(j){a=[];a.push({label:"Type",type:"span",value:j.live?"Live":"Pre-recorded (VoD)"});"format"in j&&a.push({label:"Format",type:"span",value:j.format});j.live&&a.push({label:"Buffer window",type:"span",value:UI.format.addUnit(j.buffer_window,"ms")});b={vheader:"Audio",labels:["Codec","Duration",
|
"yes":"no"));if(a.embedded&&a.embedded.type==g.type){h.css("outline","1px solid rgba(0,0,0,0.5)");h.find("input[type=radio]").prop("checked",true)}}S.html(UI.buildUI(e));var j;if(c in mistvideo)j=mistvideo[c].meta;if(j){a=[];a.push({label:"Type",type:"span",value:j.live?"Live":"Pre-recorded (VoD)"});"format"in j&&a.push({label:"Format",type:"span",value:j.format});j.live&&a.push({label:"Buffer window",type:"span",value:UI.format.addUnit(j.buffer_window,"ms")});b={vheader:"Audio",labels:["Codec","Duration",
|
||||||
"Average bitrate","Channels","Samplerate"],content:[]};f={vheader:"Video",labels:["Codec","Duration","Average bitrate","Size","Framerate"],content:[]};d=Object.keys(j.tracks);d.sort(function(a,b){a=a.split("_").pop();b=b.split("_").pop();return a-b});for(var k in d){e=d[k];g=j.tracks[e];switch(g.type){case "audio":b.content.push({header:"Track "+e.split("_").pop(),body:[g.codec,UI.format.duration((g.lastms-g.firstms)/1E3)+"<br><span class=description>"+UI.format.duration(g.firstms/1E3)+" to "+UI.format.duration(g.lastms/
|
"Average bitrate","Channels","Samplerate"],content:[]};f={vheader:"Video",labels:["Codec","Duration","Average bitrate","Size","Framerate"],content:[]};d=Object.keys(j.tracks);d.sort(function(a,b){a=a.split("_").pop();b=b.split("_").pop();return a-b});for(var k in d){e=d[k];g=j.tracks[e];switch(g.type){case "audio":b.content.push({header:"Track "+e.split("_").pop(),body:[g.codec,UI.format.duration((g.lastms-g.firstms)/1E3)+"<br><span class=description>"+UI.format.duration(g.firstms/1E3)+" to "+UI.format.duration(g.lastms/
|
||||||
1E3)+"</span>",UI.format.bytes(g.bps,1),g.channels,UI.format.addUnit(UI.format.number(g.rate),"Hz")]});break;case "video":f.content.push({header:"Track "+e.split("_").pop(),body:[g.codec,UI.format.duration((g.lastms-g.firstms)/1E3)+"<br><span class=description>"+UI.format.duration(g.firstms/1E3)+" to "+UI.format.duration(g.lastms/1E3)+"</span>",UI.format.bytes(g.bps,1),UI.format.addUnit(g.width,"x ")+UI.format.addUnit(g.height,"px"),UI.format.addUnit(UI.format.number(g.fpks/1E3),"fps")]})}}j=UI.buildVheaderTable(b).css("width",
|
1E3)+"</span>",UI.format.bytes(g.bps,1),g.channels,UI.format.addUnit(UI.format.number(g.rate),"Hz")]});break;case "video":f.content.push({header:"Track "+e.split("_").pop(),body:[g.codec,UI.format.duration((g.lastms-g.firstms)/1E3)+"<br><span class=description>"+UI.format.duration(g.firstms/1E3)+" to "+UI.format.duration(g.lastms/1E3)+"</span>",UI.format.bytes(g.bps,1),UI.format.addUnit(g.width,"x ")+UI.format.addUnit(g.height,"px"),UI.format.addUnit(UI.format.number(g.fpks/1E3),"fps")]})}}j=UI.buildVheaderTable(b).css("width",
|
||||||
"auto");k=UI.buildVheaderTable(f).css("width","auto");a.push($("<span>").text("Tracks:"));a.push($("<div>").css({display:"flex","flex-flow":"row wrap","justify-content":"center","font-size":"0.9em"}).append(j).append(k));K.html(UI.buildUI(a))}else K.html("No meta information available.")}};y.html("")[0].appendChild(a)};H();var L=UI.elements.secondary_menu;L.html("").append($("<a>").addClass("button").text("Choose stream").click(function(){UI.navto("Preview")})).append($("<span>").addClass("separator"));
|
"auto");k=UI.buildVheaderTable(f).css("width","auto");a.push($("<span>").text("Tracks:"));a.push($("<div>").css({display:"flex","flex-flow":"row wrap","justify-content":"center","font-size":"0.9em"}).append(j).append(k));K.html(UI.buildUI(a))}else K.html("No meta information available.")}};y.html("")[0].appendChild(a)};H();var L=UI.elements.secondary_menu;L.html("").append($("<a>").addClass("button").text("Choose stream").click(function(){UI.navto("Preview")})).append($("<span>").addClass("separator"));
|
||||||
|
@ -147,7 +147,7 @@ a.swapfree)*1048576),UI.format.addUnit("","N/A"),UI.format.bytes(a.swapfree*1048
|
||||||
pointer:{main:n,index:"configfile"}},{type:"buttons",buttons:[{type:"save",label:"Send","function":function(a){$(a).text("Sending..");$.ajax({type:"POST",url:"http://mistserver.org/contact_us?skin=plain",data:n,success:function(a){a=$("<span>").html(a);a.find("script").remove();b.html(a[0].innerHTML)}})}}]}]));break;case "Disconnect":mist.user.password="";delete mist.user.authstring;delete mist.user.loggedin;UI.navto("Login");break;default:b.append($("<p>").text("This tab does not exist."))}}}},mist=
|
pointer:{main:n,index:"configfile"}},{type:"buttons",buttons:[{type:"save",label:"Send","function":function(a){$(a).text("Sending..");$.ajax({type:"POST",url:"http://mistserver.org/contact_us?skin=plain",data:n,success:function(a){a=$("<span>").html(a);a.find("script").remove();b.html(a[0].innerHTML)}})}}]}]));break;case "Disconnect":mist.user.password="";delete mist.user.authstring;delete mist.user.loggedin;UI.navto("Login");break;default:b.append($("<p>").text("This tab does not exist."))}}}},mist=
|
||||||
{data:{},user:{name:"",password:"",host:"http://"+(location.hostname?location.hostname:"localhost")+":4242/api"},send:function(a,c,b){var c=c||{},b=b||{},b=$.extend(!0,{timeout:30,sendData:c},b),d={authorize:{password:mist.user.authstring?MD5(MD5(mist.user.password)+mist.user.authstring):"",username:mist.user.name}};$.extend(!0,d,c);log("Send",$.extend(!0,{},c));d={url:mist.user.host,type:"POST",data:{command:JSON.stringify(d)},dataType:"jsonp",crossDomain:!0,timeout:1E3*b.timeout,async:!0,error:function(d,
|
{data:{},user:{name:"",password:"",host:"http://"+(location.hostname?location.hostname:"localhost")+":4242/api"},send:function(a,c,b){var c=c||{},b=b||{},b=$.extend(!0,{timeout:30,sendData:c},b),d={authorize:{password:mist.user.authstring?MD5(MD5(mist.user.password)+mist.user.authstring):"",username:mist.user.name}};$.extend(!0,d,c);log("Send",$.extend(!0,{},c));d={url:mist.user.host,type:"POST",data:{command:JSON.stringify(d)},dataType:"jsonp",crossDomain:!0,timeout:1E3*b.timeout,async:!0,error:function(d,
|
||||||
f){delete mist.user.loggedin;if(!b.hide){switch(f){case "timeout":f=$("<i>").text("The connection timed out. ");break;case "abort":f=$("<i>").text("The connection was aborted. ");break;default:f=$("<i>").text(f+". ").css("text-transform","capitalize")}$("#message").addClass("red").text("An error occurred while attempting to communicate with MistServer:").append($("<br>")).append(f).append($("<a>").text("Send server request again").click(function(){mist.send(a,c,b)}))}UI.navto("Login")},success:function(d){log("Receive",
|
f){delete mist.user.loggedin;if(!b.hide){switch(f){case "timeout":f=$("<i>").text("The connection timed out. ");break;case "abort":f=$("<i>").text("The connection was aborted. ");break;default:f=$("<i>").text(f+". ").css("text-transform","capitalize")}$("#message").addClass("red").text("An error occurred while attempting to communicate with MistServer:").append($("<br>")).append(f).append($("<a>").text("Send server request again").click(function(){mist.send(a,c,b)}))}UI.navto("Login")},success:function(d){log("Receive",
|
||||||
$.extend(!0,{},d),"as reply to",b.sendData);delete mist.user.loggedin;switch(d.authorize.status){case "OK":"streams"in d&&(d.streams?"incomplete list"in d.streams?(delete d.streams["incomplete list"],$.extend(mist.data.streams,d.streams)):mist.data.streams=d.streams:mist.data.streams={});var f=$.extend({},d),e="config capabilities ui_settings LTS active_streams browse log streams totals".split(" "),p;for(p in f)-1==e.indexOf(p)&&delete f[p];$.extend(!0,mist.data,f);mist.user.loggedin=!0;UI.elements.connection.status.text("Connected").removeClass("red").addClass("green");
|
$.extend(!0,{},d),"as reply to",b.sendData);delete mist.user.loggedin;switch(d.authorize.status){case "OK":"streams"in d&&(d.streams?"incomplete list"in d.streams?(delete d.streams["incomplete list"],$.extend(mist.data.streams,d.streams)):mist.data.streams=d.streams:mist.data.streams={});var f=$.extend({},d),e="config capabilities ui_settings LTS active_streams browse log totals".split(" "),p;for(p in f)-1==e.indexOf(p)&&delete f[p];$.extend(!0,mist.data,f);mist.user.loggedin=!0;UI.elements.connection.status.text("Connected").removeClass("red").addClass("green");
|
||||||
UI.elements.connection.user_and_host.text(mist.user.name+" @ "+mist.user.host);UI.elements.connection.msg.removeClass("red").text("Last communication with the server at "+UI.format.time((new Date).getTime()/1E3));d.LTS&&UI.elements.menu.find(".LTSonly").removeClass("LTSonly");d.log&&(f=d.log[d.log.length-1],UI.elements.connection.msg.append($("<br>")).append("Last log entry: "+UI.format.time(f[0])+" ["+f[1]+"] "+f[2]));if("totals"in d)if(f=function(a,b,c){var d;d=function(){for(var a in c.fields)e[c.fields[a]].push([k,
|
UI.elements.connection.user_and_host.text(mist.user.name+" @ "+mist.user.host);UI.elements.connection.msg.removeClass("red").text("Last communication with the server at "+UI.format.time((new Date).getTime()/1E3));d.LTS&&UI.elements.menu.find(".LTSonly").removeClass("LTSonly");d.log&&(f=d.log[d.log.length-1],UI.elements.connection.msg.append($("<br>")).append("Last log entry: "+UI.format.time(f[0])+" ["+f[1]+"] "+f[2]));if("totals"in d)if(f=function(a,b,c){var d;d=function(){for(var a in c.fields)e[c.fields[a]].push([k,
|
||||||
0])};var e={},f;for(f in c.fields)e[c.fields[f]]=[];var h=0,k;if(c.data){if(c.end-c.start<600){k=(c.end-600)*1E3;d();k=c.start*1E3;d()}else k=c.start*1E3;for(f in c.data){if(f==0){k=c.start*1E3;var m=0}else{k=k+c.interval[m][1]*1E3;c.interval[m][0]--;if(c.interval[m][0]<=0){m++;m<c.interval.length-1&&(h=2)}}if(h==1){d();h--}for(var p in c.data[f])e[c.fields[p]].push([k,c.data[f][p]]);if(h){d();h--}}if(mist.data.config.time-c.end>5){d();k=mist.data.config.time*1E3;d()}}else{k=(mist.data.config.time-
|
0])};var e={},f;for(f in c.fields)e[c.fields[f]]=[];var h=0,k;if(c.data){if(c.end-c.start<600){k=(c.end-600)*1E3;d();k=c.start*1E3;d()}else k=c.start*1E3;for(f in c.data){if(f==0){k=c.start*1E3;var m=0}else{k=k+c.interval[m][1]*1E3;c.interval[m][0]--;if(c.interval[m][0]<=0){m++;m<c.interval.length-1&&(h=2)}}if(h==1){d();h--}for(var p in c.data[f])e[c.fields[p]].push([k,c.data[f][p]]);if(h){d();h--}}if(mist.data.config.time-c.end>5){d();k=mist.data.config.time*1E3;d()}}else{k=(mist.data.config.time-
|
||||||
600)*1E3;d();k=mist.data.config.time*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={},"fields"in d.totals)f(c.totals.streams,c.totals.protocols,d.totals);else for(p in d.totals)f(c.totals[p].streams,c.totals[p].protocols,d.totals[p]);a&&a(d,b);break;case "CHALL":d.authorize.challenge==
|
600)*1E3;d();k=mist.data.config.time*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={},"fields"in d.totals)f(c.totals.streams,c.totals.protocols,d.totals);else for(p in d.totals)f(c.totals[p].streams,c.totals[p].protocols,d.totals[p]);a&&a(d,b);break;case "CHALL":d.authorize.challenge==
|
||||||
|
|
|
@ -4211,7 +4211,7 @@ var mist = {
|
||||||
case 'OK':
|
case 'OK':
|
||||||
//communication succesful
|
//communication succesful
|
||||||
|
|
||||||
//fix the weird ass incomplete stream shit
|
//fix the weird ass incomplete list stream shit
|
||||||
if ('streams' in d) {
|
if ('streams' in d) {
|
||||||
if (d.streams) {
|
if (d.streams) {
|
||||||
if ('incomplete list' in d.streams) {
|
if ('incomplete list' in d.streams) {
|
||||||
|
@ -4229,7 +4229,7 @@ var mist = {
|
||||||
|
|
||||||
//remove everything we don't care about
|
//remove everything we don't care about
|
||||||
var save = $.extend({},d);
|
var save = $.extend({},d);
|
||||||
var keep = ['config','capabilities','ui_settings','LTS','active_streams','browse','log','streams','totals'];
|
var keep = ['config','capabilities','ui_settings','LTS','active_streams','browse','log','totals']; //streams was already copied above
|
||||||
for (var i in save) {
|
for (var i in save) {
|
||||||
if (keep.indexOf(i) == -1) {
|
if (keep.indexOf(i) == -1) {
|
||||||
delete save[i];
|
delete save[i];
|
||||||
|
|
Loading…
Add table
Reference in a new issue