From 63f9fb52a50e77ccdf5fb0ee0b2f2006816d89f6 Mon Sep 17 00:00:00 2001 From: cat Date: Fri, 20 Nov 2015 12:04:58 +0100 Subject: [PATCH] LSP / embed support for appending a string to the video url --- lsp/minified.js | 69 +++++++++++++++++++++++++------------------------ lsp/mist.js | 16 ++++++++++++ src/embed.js | 22 ++++++++++++---- 3 files changed, 68 insertions(+), 39 deletions(-) diff --git a/lsp/minified.js b/lsp/minified.js index 3e3228fc..ffb9d4ad 100644 --- a/lsp/minified.js +++ b/lsp/minified.js @@ -85,40 +85,41 @@ var l=function(){function a(b){var c=mist.data.capabilities.connectors[b.connect " ");$ul.append(a);typeof h[b.deps[e]]!="undefined"||typeof h[b.deps[e]+".exe"]!="undefined"?a.append($("").addClass("green").text("(Configured)")):a.append($("").addClass("red").text("(Not yet configured)"))}d.unshift({type:"text",text:$t[0].innerHTML})}return UI.buildUI(d)},h={};for(r in mist.data.config.protocols)h[mist.data.config.protocols[r].connector]=1;if(j){var q=mist.data.config.protocols[c],n=q;b.find("h2").append(' "'+q.connector+'"');b.append(P(q.connector))}else{b.html($("

").text("New Protocol")); var n={},t=[];for(r in mist.data.capabilities.connectors)t.push([r,r]);var Q=$("");b.append(UI.buildUI([{label:"Protocol",type:"select",select:t,"function":function(){Q.html(P($(this).getval()))}}])).append(Q)}break;case "Streams":if(!("capabilities"in mist.data)){b.html("Loading..");mist.send(function(){UI.navto(a)},{capabilities:!0});break}g=$("").append($("").append("").attr("colspan",6).text("Loading.."));q=$("").html($("").html($("").html($("").data("index",d).html($("").data("index",d).html($("
").text("Stream name").attr("data-sort-type", "string").addClass("sorting-asc")).append($("").text("Source").attr("data-sort-type","string")).append($("").text("Status").attr("data-sort-type","int")).append($("").css("text-align","right").text("Connections").attr("data-sort-type","int")).append($("")).append($("")))).append(g);b.append(UI.buildUI([{type:"help",help:"Here you can create, edit or delete new and existing streams. Immidiately go to the stream preview or view the information available about the stream with the info button."}])).append($("").css("text-align","right").html($("").addClass("description").text("Loading..")),h=0;if(typeof mist.data.totals!="undefined"&&typeof mist.data.totals[d]!="undefined"){var i=mist.data.totals[d].all_protocols.clients,h=0;if(i.length){for(a in i)h=h+i[a][1];h=Math.round(h/i.length)}}f.html(UI.format.number(h));if(h==0&&e.online==1)e.online=2;h=$("").css("text-align","right").css("white-space","nowrap");(!("ischild"in e)|| +q.stupidtable();var D=function(){var a=[],b;for(b in mist.data.active_streams)a.push({streams:[mist.data.active_streams[b]],fields:["clients"],start:-2});mist.send(function(){$.extend(true,y,mist.data.streams);var a=0;g.html("");if(mist.data.LTS)for(a in mist.data.active_streams){var b=mist.data.active_streams[a].split("+");if(!(b.length<2)&&b[0]in mist.data.streams){b=R(mist.data.active_streams[a],mist.data.streams[b[0]]);b.online=1;y[mist.data.active_streams[a]]=b}}b=Object.keys(y);b.sort();for(var c in b){var d= +b[c],e;e=d in mist.data.streams?mist.data.streams[d]:y[d];var f=$("").css("text-align","right").html($("").addClass("description").text("Loading..")),h=0;if(typeof mist.data.totals!="undefined"&&typeof mist.data.totals[d]!="undefined"){var i=mist.data.totals[d].all_protocols.clients,h=0;if(i.length){for(a in i)h=h+i[a][1];h=Math.round(h/i.length)}}f.html(UI.format.number(h));if(h==0&&e.online==1)e.online=2;h=$("").css("text-align","right").css("white-space","nowrap");(!("ischild"in e)|| !e.ischild)&&h.html($("
").html(i).attr("title",d).addClass("overflow_ellipsis")).append($("").text(e.source).attr("title",e.source).addClass("description").addClass("overflow_ellipsis").css("max-width","20em")).append($("").data("sort-value",e.online).html(j)).append(f).append($("").html(k)).append(h)); -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()}, +UI.format.status(e),S=$("
").html(i).attr("title",d).addClass("overflow_ellipsis")).append($("").text(e.source).attr("title",e.source).addClass("description").addClass("overflow_ellipsis").css("max-width","20em")).append($("").data("sort-value",e.online).html(j)).append(f).append($("").html(S)).append(h)); +a++}},{totals:a,active_streams:true})},y=$.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 B=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)&&(y[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];y[f]=R(f,mist.data.streams[c]);y[f].source=mist.data.streams[c].source+a.browse.files[d]}a.browse.files.length?y[c].filesfound=true:mist.data.streams[c].filesfound=false;E++;if(B==E){mist.send(function(){D()},{active_streams:true});UI.interval.set(function(){D()},1E4)}},{browse:mist.data.streams[i].source},{stream:i}),B++);0==B&&(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($("

").text("New Stream")),n={});i=[];for(r in mist.data.capabilities.inputs)i.push(mist.data.capabilities.inputs[r].source_match); var G=$("
");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.
VoD:You can browse to the file or folder as a source or simply enter the path to the file.
Live:You\'ll need to enter "push://IP" with the IP of the machine pushing towards MistServer.
You can use "push://" to accept any source.
(Pro only)Use "push://(IP)@password" to set a password protection for pushes.
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)G.html($("

").text("Unrecognized input").addClass("red")).append($("").text("Please edit the stream source.").addClass("red"));else{a=mist.data.capabilities.inputs[b];G.html($("

").text(a.name+" Input options"));a=mist.convertBuildOptions(a, n);G.append(UI.buildUI(a))}}}},$("
"),{type:"custom",custom:G},$("
"),$("

").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.
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"}},$("
"),{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]= -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($("

").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($("

").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($("

").text("Limits")).append(UI.buildLimits(i,a,c)));break;case "Preview":if(""==c){b.append("Loading..");var J=function(c){var d={};c.sort();b.html($("

").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($("").addClass("button").addClass("active").text("Choose stream").click(function(){UI.navto("Preview")}));var e=$("
").addClass("preview_icons");b.append($("").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($("