LSP: for new streams, if the input is TSSRT or TSRIST, put always_on true by default

This commit is contained in:
Cat 2023-11-27 11:21:30 +01:00 committed by Thulinma
parent ec757f48e9
commit 0ad88e80b3
2 changed files with 10 additions and 9 deletions

View file

@ -156,14 +156,14 @@ mist.data.config.protocols[i];if(l.connector==k){if("port"in l)f[k]=l.port;break
k+"?streamname="+(a==""?"STREAMNAME":a);break;case "RTSP":case "RTSP.exe":q="rtsp://"+b.host+k+"/"+(a==""?"STREAMNAME":a)+(e?"?pass="+e:"");break;case "TS":case "TS.exe":q="udp://"+(g==""?b.host:g)+k+"/"}P.find(".field."+i.replace(".exe","")).setval(q).closest("label").show()}}},Ta=$("<div>"),sa={},u=[],Ua=$("<div>");for(r in mist.data.capabilities.processes)u.push([r,mist.data.capabilities.processes[r].hrn?mist.data.capabilities.processes[r].hrn:mist.data.capabilities.processes[r].name]);if(u.length){var jb=
[{label:"New process",type:"select",select:u,value:u[0][0],pointer:{main:sa,index:"process"},"function":function(){var a=$(this).getval();if(a!=null){var a=mist.data.capabilities.processes[a],b=[$("<h4>").text(a.name+" Process options")];Ua.html(UI.buildUI(b.concat(mist.convertBuildOptions(a,sa))))}}},Ua];Ta.append(UI.buildUI([$("<br>"),$("<h3>").text("Stream processes"),{label:"Stream processes",itemLabel:"stream process",type:"sublist",sublist:jb,saveas:sa,pointer:{main:p,index:"processes"}}]))}c.append(UI.buildUI([{label:"Stream name",
type:"str",validate:["required","streamname"],pointer:{main:p,index:"name"},help:"Set the name this stream will be recognised by for players and/or stream pushing."},{label:"Source",type:"browse",filetypes:Qa,pointer:{main:p,index:"source"},help:"<p> Below is the explanation of the input methods for MistServer. Anything between brackets () will go to default settings if not specified. </p> <table class=valigntop> <tr> <th colspan=3><b>File inputs</b></th> </tr> <tr> <th>File</th> <td> Linux/MacOS:&nbsp;/PATH/FILE<br> Windows:&nbsp;/cygdrive/DRIVE/PATH/FILE </td> <td> For file input please specify the proper path and file.<br> Supported inputs are: DTSC, FLV, MP3. MistServer Pro has TS, MP4, ISMV added as input. </td> </tr> <th> Folder </th> <td> Linux/MacOS:&nbsp;/PATH/<br> Windows:&nbsp;/cygdrive/DRIVE/PATH/ </td> <td> A folder stream makes all the recognised files in the selected folder available as a stream. </td> </tr> <tr><td colspan=3>&nbsp;</td></tr> <tr> <th colspan=3><b>Push inputs</b></th> </tr> <tr> <th>RTMP</th> <td>push://(IP)(@PASSWORD)</td> <td> IP is white listed IP for pushing towards MistServer, if left empty all are white listed.<br> PASSWORD is the application under which to push to MistServer, if it doesn't match the stream will be rejected. PASSWORD is MistServer Pro only. </td> </tr> <tr> <th>SRT</th> <td>push://(IP)</td> <td> IP is white listed IP for pushing towards MistServer, if left empty all are white listed.<br> </td> </tr> <tr> <th>RTSP</th> <td>push://(IP)(@PASSWORD)</td> <td>IP is white listed IP for pushing towards MistServer, if left empty all are white listed.</td> </tr> <tr> <th>TS</th> <td>tsudp://(IP):PORT(/INTERFACE)</td> <td> IP is the IP address used to listen for this stream, multi-cast IP range is: 224.0.0.0 - 239.255.255.255. If IP is not set all addresses will listened to.<br> PORT is the port you reserve for this stream on the chosen IP.<br> INTERFACE is the interface used, if left all interfaces will be used. </td> </tr> <tr><td colspan=3>&nbsp;</td></tr> <tr> <th colspan=3><b>Pull inputs</b></th> </tr> <tr> <th>DTSC</th> <td>dtsc://MISTSERVER_IP:PORT/(STREAMNAME)</td> <td>MISTSERVER_IP is the IP of another MistServer to pull from.<br> PORT is the DTSC port of the other MistServer. (default is 4200)<br> STREAMNAME is the name of the target stream on the other MistServer. If left empty, the name of this stream will be used. </td> </tr> <tr> <th>HLS</th> <td>http://URL/TO/STREAM.m3u8</td> <td>The URL where the HLS stream is available to MistServer.</td> </tr> <tr> <th>RTSP</th> <td>rtsp://(USER:PASSWORD@)IP(:PORT)(/path)</td> <td> USER:PASSWORD is the account used if authorization is required.<br> IP is the IP address used to pull this stream from.<br> PORT is the port used to connect through.<br> PATH is the path to be used to identify the correct stream. </td> </tr> </table>",
"function":function(){var a=$(this).val();Sa.remove();P.html("");if(a!=""){var b=null,d;for(d in mist.data.capabilities.inputs)if(typeof mist.data.capabilities.inputs[d].source_match!="undefined"&&mist.inputMatch(mist.data.capabilities.inputs[d].source_match,a)){b=d;break}if(b===null)fa.html($("<h3>").text("Unrecognized input").addClass("red")).append($("<span>").text("Please edit the stream source.").addClass("red"));else{b=mist.data.capabilities.inputs[b];fa.html($("<h3>").text(b.name+" Input options"));
var e=mist.convertBuildOptions(b,p);"always_match"in mist.data.capabilities.inputs[d]&&mist.inputMatch(mist.data.capabilities.inputs[d].always_match,a)&&e.push({label:"Always on",type:"checkbox",help:"Keep this input available at all times, even when there are no active viewers.",pointer:{main:p,index:"always_on"}});fa.append(UI.buildUI(e));if(b.name=="Folder")c.append(Sa);else if(["Buffer","Buffer.exe","TS","TS.exe"].indexOf(b.name)>-1){d=[$("<br>"),$("<span>").text("Configure your source to push to:")];
switch(b.name){case "Buffer":case "Buffer.exe":d.push({label:"RTMP full url",type:"span",clipboard:true,readonly:true,classes:["RTMP"],help:"Use this RTMP url if your client doesn't ask for a stream key"});d.push({label:"RTMP url",type:"span",clipboard:true,readonly:true,classes:["RTMPurl"],help:"Use this RTMP url if your client also asks for a stream key"});d.push({label:"RTMP stream key",type:"span",clipboard:true,readonly:true,classes:["RTMPkey"],help:"Use this key if your client asks for a stream key"});
d.push({label:"SRT",type:"span",clipboard:true,readonly:true,classes:["TSSRT"]});d.push({label:"RTSP",type:"span",clipboard:true,readonly:true,classes:["RTSP"]});break;case "TS":case "TS.exe":a.charAt(0)=="/"?d=[]:d.push({label:"TS",type:"span",clipboard:true,readonly:true,classes:["TS"]})}P.html(UI.buildUI(d));ra()}}}}},{label:"Stop sessions",type:"checkbox",help:"When saving these stream settings, kill this stream's current connections.",pointer:{main:p,index:"stop_sessions"}},P,$("<br>"),{type:"custom",
custom:fa},Ta,{type:"buttons",buttons:[{type:"cancel",label:"Cancel","function":function(){UI.navto("Streams")}},{type:"save",label:"Save","function":function(){Ra("Streams")}},{type:"save",label:"Save and Preview","function":function(){Ra("Preview")},classes:["saveandpreview"]}]}]));c.find("[name=name]").keyup(function(){ra()});ra();break;case "Preview":""==b&&UI.navto("Streams");var Q=parseURL(mist.user.host),W=Q.protocol,T=Q.host,J=":8080",v=W+T+J+"/";for(r in mist.data.config.protocols)if(s=mist.data.config.protocols[r],
"HTTP"==s.connector||"HTTP.exe"==s.connector){s.pubaddr&&s.pubaddr.length?"string"==typeof s.pubaddr?v=s.pubaddr.replace(/\/$/,"")+"/":s.pubaddr.length&&(v=s.pubaddr[0].replace(/\/$/,"")+"/"):(J=s.port?":"+s.port:":8080",v=W+T+J+"/");break}var S=$("<div>").css({display:"flex","flex-flow":"row wrap","flex-shrink":1,"min-width":"auto"}),X="";-1==b.indexOf("+")&&(X=$("<button>").text("Settings").addClass("settings").click(function(){UI.navto("Edit",b)}));c.html($("<div>").addClass("bigbuttons").append(X).append($("<button>").text("Embed").addClass("embed").click(function(){UI.navto("Embed",
b)})).append($("<button>").addClass("cancel").addClass("return").text("Return").click(function(){UI.navto("Streams")}))).append($("<h2>").text('Preview of "'+b+'"')).append(S);var K=encodeURIComponent(b),Va=$("<div>").css("flex-shrink","1").css("min-width","auto").css("max-width","100%");S.append(Va);var Wa=$("<div>"),Y=$("<div>").text("Loading player..").css("max-width","100%").css("flex-shrink","1").css("min-width","auto"),ta=$("<div>").addClass("controls");Va.append(Y).append(Wa).append(ta);$("link#devcss").length||
c.append($("<link>").attr("rel","stylesheet").attr("type","text/css").attr("href",v+"skins/dev.css").attr("id","devcss"));var Xa=function(){Wa.text("");var d=document.createElement("script");c.append(d);d.src=v+"player.js";d.onerror=function(){Y.html($("<p>").append('Failed to load <a href="'+v+'player.js">'+v+"player.js</a>.")).append($("<p>").append("Please check if you've activated the HTTP protocol, if your http port is blocked, or if you're trying to load HTTPS on an HTTP page.")).append($("<button>").text("Reload").css("display",
"function":function(){var a=$(this).val();Sa.remove();P.html("");if(a!=""){var d=null,e;for(e in mist.data.capabilities.inputs)if(typeof mist.data.capabilities.inputs[e].source_match!="undefined"&&mist.inputMatch(mist.data.capabilities.inputs[e].source_match,a)){d=e;break}if(d===null)fa.html($("<h3>").text("Unrecognized input").addClass("red")).append($("<span>").text("Please edit the stream source.").addClass("red"));else{d=mist.data.capabilities.inputs[d];fa.html($("<h3>").text(d.name+" Input options"));
var g=mist.convertBuildOptions(d,p);"always_match"in mist.data.capabilities.inputs[e]&&mist.inputMatch(mist.data.capabilities.inputs[e].always_match,a)&&g.push({label:"Always on",type:"checkbox",help:"Keep this input available at all times, even when there are no active viewers.",pointer:{main:p,index:"always_on"},value:b==""&&(e=="TSSRT"||e=="TSRIST")?true:false});fa.append(UI.buildUI(g));if(d.name=="Folder")c.append(Sa);else if(["Buffer","Buffer.exe","TS","TS.exe"].indexOf(d.name)>-1){e=[$("<br>"),
$("<span>").text("Configure your source to push to:")];switch(d.name){case "Buffer":case "Buffer.exe":e.push({label:"RTMP full url",type:"span",clipboard:true,readonly:true,classes:["RTMP"],help:"Use this RTMP url if your client doesn't ask for a stream key"});e.push({label:"RTMP url",type:"span",clipboard:true,readonly:true,classes:["RTMPurl"],help:"Use this RTMP url if your client also asks for a stream key"});e.push({label:"RTMP stream key",type:"span",clipboard:true,readonly:true,classes:["RTMPkey"],
help:"Use this key if your client asks for a stream key"});e.push({label:"SRT",type:"span",clipboard:true,readonly:true,classes:["TSSRT"]});e.push({label:"RTSP",type:"span",clipboard:true,readonly:true,classes:["RTSP"]});break;case "TS":case "TS.exe":a.charAt(0)=="/"?e=[]:e.push({label:"TS",type:"span",clipboard:true,readonly:true,classes:["TS"]})}P.html(UI.buildUI(e));ra()}}}}},{label:"Stop sessions",type:"checkbox",help:"When saving these stream settings, kill this stream's current connections.",
pointer:{main:p,index:"stop_sessions"}},P,$("<br>"),{type:"custom",custom:fa},Ta,{type:"buttons",buttons:[{type:"cancel",label:"Cancel","function":function(){UI.navto("Streams")}},{type:"save",label:"Save","function":function(){Ra("Streams")}},{type:"save",label:"Save and Preview","function":function(){Ra("Preview")},classes:["saveandpreview"]}]}]));c.find("[name=name]").keyup(function(){ra()});ra();break;case "Preview":""==b&&UI.navto("Streams");var Q=parseURL(mist.user.host),W=Q.protocol,T=Q.host,
J=":8080",v=W+T+J+"/";for(r in mist.data.config.protocols)if(s=mist.data.config.protocols[r],"HTTP"==s.connector||"HTTP.exe"==s.connector){s.pubaddr&&s.pubaddr.length?"string"==typeof s.pubaddr?v=s.pubaddr.replace(/\/$/,"")+"/":s.pubaddr.length&&(v=s.pubaddr[0].replace(/\/$/,"")+"/"):(J=s.port?":"+s.port:":8080",v=W+T+J+"/");break}var S=$("<div>").css({display:"flex","flex-flow":"row wrap","flex-shrink":1,"min-width":"auto"}),X="";-1==b.indexOf("+")&&(X=$("<button>").text("Settings").addClass("settings").click(function(){UI.navto("Edit",
b)}));c.html($("<div>").addClass("bigbuttons").append(X).append($("<button>").text("Embed").addClass("embed").click(function(){UI.navto("Embed",b)})).append($("<button>").addClass("cancel").addClass("return").text("Return").click(function(){UI.navto("Streams")}))).append($("<h2>").text('Preview of "'+b+'"')).append(S);var K=encodeURIComponent(b),Va=$("<div>").css("flex-shrink","1").css("min-width","auto").css("max-width","100%");S.append(Va);var Wa=$("<div>"),Y=$("<div>").text("Loading player..").css("max-width",
"100%").css("flex-shrink","1").css("min-width","auto"),ta=$("<div>").addClass("controls");Va.append(Y).append(Wa).append(ta);$("link#devcss").length||c.append($("<link>").attr("rel","stylesheet").attr("type","text/css").attr("href",v+"skins/dev.css").attr("id","devcss"));var Xa=function(){Wa.text("");var d=document.createElement("script");c.append(d);d.src=v+"player.js";d.onerror=function(){Y.html($("<p>").append('Failed to load <a href="'+v+'player.js">'+v+"player.js</a>.")).append($("<p>").append("Please check if you've activated the HTTP protocol, if your http port is blocked, or if you're trying to load HTTPS on an HTTP page.")).append($("<button>").text("Reload").css("display",
"block").click(function(){Xa()}))};d.onload=function(){var e=b,g=function(){var a=MistVideoObject.reference;ta.html("");ta.append(a.UI.buildStructure({type:"container",classes:["mistvideo-column"],style:{flexShrink:1},children:[{"if":function(){return this.playerName&&this.source},then:{type:"container",classes:["mistvideo-description"],style:{display:"block"},children:[{type:"playername",style:{display:"inline"}},{type:"text",text:"is playing",style:{margin:"0 0.2em"}},{type:"mimetype"}]}},{type:"decodingIssues",
style:{"max-width":"30em","flex-flow":"column nowrap"}},{type:"container",classes:["mistvideo-column","mistvideo-devcontrols"],children:[{type:"text",text:"Player control"},{type:"container",classes:["mistvideo-devbuttons"],style:{"flex-wrap":"wrap"},children:[{"if":function(){return!(!this.player||!this.player.api)},then:{type:"button",title:"Reload the video source",label:"Reload video",onclick:function(){this.player.api.load()}}},{type:"button",title:"Build MistVideo again",label:"Reload player",
onclick:function(){this.reload()}},{type:"button",title:"Switch to the next available player and source combination",label:"Try next combination",onclick:function(){this.nextCombo()}}]},{type:"forcePlayer"},{type:"forceType"},{type:"forceSource"}]},{type:"log"}]}))};if(!(a!="Preview"||!b||b==""||e!=b)){Y[0].addEventListener("initialized",g);Y[0].addEventListener("initializeFailed",g);MistVideoObject.reference=mistPlay(e,{target:Y[0],host:v,skin:"dev",loop:true,MistVideoObject:MistVideoObject})}c[0].removeChild(d)};

View file

@ -4602,7 +4602,8 @@ var UI = {
pointer: {
main: saveas,
index: 'always_on'
}
},
value: (other == "" && ((i == "TSSRT") || (i == "TSRIST")) ? true : false) //for new streams, if the input is TSSRT or TSRIST, put always_on true by default
});
}
$inputoptions.append(UI.buildUI(build));