LSP:
- Bugfix for input options categories in checking if there are custom parameters in a push url - Option groups now have an ability to expand/collapse. When collapsed a summary of non-default configured options is shown. - Question marks in the target should be kept as part of the target url. Additional params should always be added after an additional ?. - Improved (mostly SRT) push param options layout - Fixed option groups: - 1: Typing in PUSH TARGET will reset all settings set up below - 2: If you hide settings the settings do not propogate - 3: Sublist and option categories share the same container class name, causing CSS collisions
This commit is contained in:
parent
e981e26100
commit
13845ca4fc
15 changed files with 381 additions and 258 deletions
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
|||
mistplayers.dashjs={name:"Dash.js player",mimes:["dash/video/mp4"],priority:MistUtil.object.keys(mistplayers).length+1,isMimeSupported:function(e){return MistUtil.array.indexOf(this.mimes,e)==-1?false:true},isBrowserSupported:function(e,t,i){if(location.protocol!=MistUtil.http.url.split(t.url).protocol){i.log("HTTP/HTTPS mismatch for this source");return false}if(location.protocol=="file:"){i.log("This source ("+e+") won't load if the page is run via file://");return false}if(!("MediaSource"in window)){return false}if(!MediaSource.isTypeSupported){return true}var r={};var a=false;for(var s in i.info.meta.tracks){if(i.info.meta.tracks[s].type=="meta"){if(i.info.meta.tracks[s].codec=="subtitle"){a=true}continue}if(!(i.info.meta.tracks[s].type in r)){r[i.info.meta.tracks[s].type]={}}r[i.info.meta.tracks[s].type][MistUtil.tracks.translateCodec(i.info.meta.tracks[s])]=1}var o=[];for(var n in r){var l=false;for(var f in r[n]){if(MediaSource.isTypeSupported('video/mp4;codecs="'+f+'"')){l=true;break}}if(l){o.push(n)}}if(a){for(var s in i.info.source){if(i.info.source[s].type=="html5/text/vtt"){o.push("subtitle");break}}}return o.length?o:false},player:function(){this.onreadylist=[]},scriptsrc:function(e){return e+"/dashjs.js"}};var p=mistplayers.dashjs.player;p.prototype=new MistPlayer;p.prototype.build=function(e,t){var i=this;this.onDashLoad=function(){if(e.destroyed){return}e.log("Building DashJS player..");var r=document.createElement("video");if("Proxy"in window){var a={get:{},set:{}};e.player.api=new Proxy(r,{get:function(e,t,i){if(t in a.get){return a.get[t].apply(e,arguments)}var r=e[t];if(typeof r==="function"){return function(){return r.apply(e,arguments)}}return r},set:function(e,t,i){if(t in a.set){return a.set[t].call(e,i)}return e[t]=i}});if(e.info.type=="live"){a.get.duration=function(){var t=0;if(this.buffered.length){t=this.buffered.end(this.buffered.length-1)}var i=((new Date).getTime()-e.player.api.lastProgress.getTime())*.001;return t+i+-1*e.player.api.liveOffset+45};a.set.currentTime=function(t){var i=t-e.player.api.duration;e.log("Seeking to "+MistUtil.format.time(t)+" ("+Math.round(i*-10)/10+"s from live)");e.video.currentTime=t};MistUtil.event.addListener(r,"progress",function(){e.player.api.lastProgress=new Date});e.player.api.lastProgress=new Date;e.player.api.liveOffset=0}}else{i.api=r}if(e.options.autoplay){r.setAttribute("autoplay","")}if(e.options.loop&&e.info.type!="live"){r.setAttribute("loop","")}if(e.options.poster){r.setAttribute("poster",e.options.poster)}if(e.options.muted){r.muted=true}if(e.options.controls=="stock"){r.setAttribute("controls","")}var s=dashjs.MediaPlayer().create();s.initialize(r,e.source.url,e.options.autoplay);i.dash=s;var o=["METRIC_ADDED","METRIC_UPDATED","METRIC_CHANGED","METRICS_CHANGED","FRAGMENT_LOADING_STARTED","FRAGMENT_LOADING_COMPLETED","LOG","PLAYBACK_TIME_UPDATED","PLAYBACK_PROGRESS"];for(var n in dashjs.MediaPlayer.events){if(o.indexOf(n)<0){i.dash.on(dashjs.MediaPlayer.events[n],function(t){e.log("Player event fired: "+t.type)})}}e.player.setSize=function(e){this.api.style.width=e.width+"px";this.api.style.height=e.height+"px"};e.player.api.setSource=function(t){e.player.dash.attachSource(t)};if(e.options.controls!="stock"){i.dash.updateSettings({streaming:{text:{defaultEnabled:false}}})}var l=false;i.dash.on("allTextTracksAdded",function(){l=true});e.player.api.setSubtitle=function(t){if(!l){var r=function(){e.player.api.setSubtitle(t);i.dash.off("allTextTracksAdded",r)};i.dash.on("allTextTracksAdded",r);return}if(!t){i.dash.enableText(false);return}var a=i.dash.getTracksFor("text");for(var s in a){var o="idx"in t?t.idx:t.trackid;if(a[s].id==o){i.dash.setTextTrack(s);if(!i.dash.isTextEnabled()){i.dash.enableText()}return true}}return false};MistUtil.event.addListener(r,"progress",function(t){if(e.container.getAttribute("data-loading")=="stalled"){e.container.removeAttribute("data-loading")}});i.api.unload=function(){i.dash.reset()};e.log("Built html");t(r)};if("dashjs"in window){this.onDashLoad()}else{var r=MistUtil.scripts.insert(e.urlappend(mistplayers.dashjs.scriptsrc(e.options.host)),{onerror:function(t){var i="Failed to load dashjs.js";if(t.message){i+=": "+t.message}e.showError(i)},onload:i.onDashLoad},e)}};
|
||||
mistplayers.dashjs={name:"Dash.js player",mimes:["dash/video/mp4"],priority:MistUtil.object.keys(mistplayers).length+1,isMimeSupported:function(e){return MistUtil.array.indexOf(this.mimes,e)==-1?false:true},isBrowserSupported:function(e,t,i){if(location.protocol!=MistUtil.http.url.split(t.url).protocol){i.log("HTTP/HTTPS mismatch for this source");return false}if(location.protocol=="file:"){i.log("This source ("+e+") won't load if the page is run via file://");return false}if(!("MediaSource"in window)){return false}if(!MediaSource.isTypeSupported){return true}var r={};var a=false;for(var s in i.info.meta.tracks){if(i.info.meta.tracks[s].type=="meta"){if(i.info.meta.tracks[s].codec=="subtitle"){a=true}continue}if(!(i.info.meta.tracks[s].type in r)){r[i.info.meta.tracks[s].type]={}}r[i.info.meta.tracks[s].type][MistUtil.tracks.translateCodec(i.info.meta.tracks[s])]=1}var o=[];for(var n in r){var l=false;for(var f in r[n]){if(MediaSource.isTypeSupported('video/mp4;codecs="'+f+'"')){l=true;break}}if(l){o.push(n)}}if(a){for(var s in i.info.source){if(i.info.source[s].type=="html5/text/vtt"){o.push("subtitle");break}}}return o.length?o:false},player:function(){this.onreadylist=[]},scriptsrc:function(e){return e+"/dashjs.js"}};var p=mistplayers.dashjs.player;p.prototype=new MistPlayer;p.prototype.build=function(e,t){var i=this;this.onDashLoad=function(){if(e.destroyed){return}e.log("Building DashJS player..");var r=document.createElement("video");if("Proxy"in window){var a={get:{},set:{}};e.player.api=new Proxy(r,{get:function(e,t,i){if(t in a.get){return a.get[t].apply(e,arguments)}var r=e[t];if(typeof r==="function"){return function(){return r.apply(e,arguments)}}return r},set:function(e,t,i){if(t in a.set){return a.set[t].call(e,i)}return e[t]=i}});if(e.info.type=="live"){a.get.duration=function(){var t=0;if(this.buffered.length){t=this.buffered.end(this.buffered.length-1)}var i=((new Date).getTime()-e.player.api.lastProgress.getTime())*.001;return t+i+-1*e.player.api.liveOffset+45};a.set.currentTime=function(t){var i=t-e.player.api.duration;e.log("Seeking to "+MistUtil.format.time(t)+" ("+Math.round(i*-10)/10+"s from live)");e.video.currentTime=t};MistUtil.event.addListener(r,"progress",(function(){e.player.api.lastProgress=new Date}));e.player.api.lastProgress=new Date;e.player.api.liveOffset=0}}else{i.api=r}if(e.options.autoplay){r.setAttribute("autoplay","")}if(e.options.loop&&e.info.type!="live"){r.setAttribute("loop","")}if(e.options.poster){r.setAttribute("poster",e.options.poster)}if(e.options.muted){r.muted=true}if(e.options.controls=="stock"){r.setAttribute("controls","")}var s=dashjs.MediaPlayer().create();s.initialize(r,e.source.url,e.options.autoplay);i.dash=s;var o=["METRIC_ADDED","METRIC_UPDATED","METRIC_CHANGED","METRICS_CHANGED","FRAGMENT_LOADING_STARTED","FRAGMENT_LOADING_COMPLETED","LOG","PLAYBACK_TIME_UPDATED","PLAYBACK_PROGRESS"];for(var n in dashjs.MediaPlayer.events){if(o.indexOf(n)<0){i.dash.on(dashjs.MediaPlayer.events[n],(function(t){e.log("Player event fired: "+t.type)}))}}e.player.setSize=function(e){this.api.style.width=e.width+"px";this.api.style.height=e.height+"px"};e.player.api.setSource=function(t){e.player.dash.attachSource(t)};if(e.options.controls!="stock"){i.dash.updateSettings({streaming:{text:{defaultEnabled:false}}})}var l=false;i.dash.on("allTextTracksAdded",(function(){l=true}));e.player.api.setSubtitle=function(t){if(!l){var r=function(){e.player.api.setSubtitle(t);i.dash.off("allTextTracksAdded",r)};i.dash.on("allTextTracksAdded",r);return}if(!t){i.dash.enableText(false);return}var a=i.dash.getTracksFor("text");for(var s in a){var o="idx"in t?t.idx:t.trackid;if(a[s].id==o){i.dash.setTextTrack(s);if(!i.dash.isTextEnabled()){i.dash.enableText()}return true}}return false};MistUtil.event.addListener(r,"progress",(function(t){if(e.container.getAttribute("data-loading")=="stalled"){e.container.removeAttribute("data-loading")}}));i.api.unload=function(){i.dash.reset()};e.log("Built html");t(r)};if("dashjs"in window){this.onDashLoad()}else{var r=MistUtil.scripts.insert(e.urlappend(mistplayers.dashjs.scriptsrc(e.options.host)),{onerror:function(t){var i="Failed to load dashjs.js";if(t.message){i+=": "+t.message}e.showError(i)},onload:i.onDashLoad},e)}};
|
|
@ -1 +1 @@
|
|||
mistplayers.flash_strobe={name:"Strobe Flash media playback",mimes:["flash/10","flash/11","flash/7"],priority:MistUtil.object.keys(mistplayers).length+1,isMimeSupported:function(t){return this.mimes.indexOf(t)==-1?false:true},isBrowserSupported:function(t,e,i){if(MistUtil.http.url.split(e.url).protocol.slice(0,4)=="http"&&location.protocol!=MistUtil.http.url.split(e.url).protocol){i.log("HTTP/HTTPS mismatch for this source");return false}var r=0;try{var a=navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;if(a.version){r=a.version.split(".")[0]}else{r=a.description.replace(/([^0-9\.])/g,"").split(".")[0]}}catch(t){}try{r=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").replace(/([^0-9\,])/g,"").split(",")[0]}catch(t){}if(!r){return false}var l=t.split("/");return Number(r)>=Number(l[l.length-1])},player:function(){this.onreadylist=[]}};var p=mistplayers.flash_strobe.player;p.prototype=new MistPlayer;p.prototype.build=function(t,e){var i=document.createElement("object");var r=document.createElement("embed");i.appendChild(r);function a(e){var a=t.options;function l(t,e){var i=document.createElement("param");i.setAttribute("name",t);i.setAttribute("value",e);return i}MistUtil.empty(i);i.appendChild(l("movie",t.urlappend(a.host+t.source.player_url)));var o="src="+encodeURIComponent(e)+"&controlBarMode="+(a.controls?"floating":"none")+"&initialBufferTime=0.5&expandedBufferTime=5&minContinuousPlaybackTime=3"+(a.live?"&streamType=live":"")+(a.autoplay?"&autoPlay=true":"")+(a.loop?"&loop=true":"")+(a.poster?"&poster="+a.poster:"")+(a.muted?"&muted=true":"");i.appendChild(l("flashvars",o));i.appendChild(l("allowFullScreen","true"));i.appendChild(l("wmode","direct"));if(a.autoplay){i.appendChild(l("autoPlay","true"))}if(a.loop){i.appendChild(l("loop","true"))}if(a.poster){i.appendChild(l("poster",a.poster))}if(a.muted){i.appendChild(l("muted","true"))}r.setAttribute("src",t.urlappend(t.source.player_url));r.setAttribute("type","application/x-shockwave-flash");r.setAttribute("allowfullscreen","true");r.setAttribute("flashvars",o)}a(t.source.url);this.api={};this.setSize=function(t){i.setAttribute("width",t.width);i.setAttribute("height",t.height);r.setAttribute("width",t.width);r.setAttribute("height",t.height)};this.setSize(t.calcSize());this.onready(function(){if(t.container){t.container.removeAttribute("data-loading")}});this.api.setSource=function(t){a(t)};t.log("Built html");e(i)};
|
||||
mistplayers.flash_strobe={name:"Strobe Flash media playback",mimes:["flash/10","flash/11","flash/7"],priority:MistUtil.object.keys(mistplayers).length+1,isMimeSupported:function(t){return this.mimes.indexOf(t)==-1?false:true},isBrowserSupported:function(t,e,i){if(MistUtil.http.url.split(e.url).protocol.slice(0,4)=="http"&&location.protocol!=MistUtil.http.url.split(e.url).protocol){i.log("HTTP/HTTPS mismatch for this source");return false}var r=0;try{var a=navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;if(a.version){r=a.version.split(".")[0]}else{r=a.description.replace(/([^0-9\.])/g,"").split(".")[0]}}catch(t){}try{r=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").replace(/([^0-9\,])/g,"").split(",")[0]}catch(t){}if(!r){return false}var l=t.split("/");return Number(r)>=Number(l[l.length-1])},player:function(){this.onreadylist=[]}};var p=mistplayers.flash_strobe.player;p.prototype=new MistPlayer;p.prototype.build=function(t,e){var i=document.createElement("object");var r=document.createElement("embed");i.appendChild(r);function a(e){var a=t.options;function l(t,e){var i=document.createElement("param");i.setAttribute("name",t);i.setAttribute("value",e);return i}MistUtil.empty(i);i.appendChild(l("movie",t.urlappend(a.host+t.source.player_url)));var o="src="+encodeURIComponent(e)+"&controlBarMode="+(a.controls?"floating":"none")+"&initialBufferTime=0.5&expandedBufferTime=5&minContinuousPlaybackTime=3"+(a.live?"&streamType=live":"")+(a.autoplay?"&autoPlay=true":"")+(a.loop?"&loop=true":"")+(a.poster?"&poster="+a.poster:"")+(a.muted?"&muted=true":"");i.appendChild(l("flashvars",o));i.appendChild(l("allowFullScreen","true"));i.appendChild(l("wmode","direct"));if(a.autoplay){i.appendChild(l("autoPlay","true"))}if(a.loop){i.appendChild(l("loop","true"))}if(a.poster){i.appendChild(l("poster",a.poster))}if(a.muted){i.appendChild(l("muted","true"))}r.setAttribute("src",t.urlappend(t.source.player_url));r.setAttribute("type","application/x-shockwave-flash");r.setAttribute("allowfullscreen","true");r.setAttribute("flashvars",o)}a(t.source.url);this.api={};this.setSize=function(t){i.setAttribute("width",t.width);i.setAttribute("height",t.height);r.setAttribute("width",t.width);r.setAttribute("height",t.height)};this.setSize(t.calcSize());this.onready((function(){if(t.container){t.container.removeAttribute("data-loading")}}));this.api.setSource=function(t){a(t)};t.log("Built html");e(i)};
|
|
@ -1 +1 @@
|
|||
mistplayers.flv={name:"HTML5 FLV Player",mimes:["flash/7"],priority:MistUtil.object.keys(mistplayers).length+1,isMimeSupported:function(e){return MistUtil.array.indexOf(this.mimes,e)==-1?false:true},isBrowserSupported:function(e,t,r){if(location.protocol!=MistUtil.http.url.split(t.url).protocol){if(location.protocol=="file:"&&MistUtil.http.url.split(t.url).protocol=="http:"){r.log("This page was loaded over file://, the player might not behave as intended.")}else{r.log("HTTP/HTTPS mismatch for this source");return false}}if(!window.MediaSource){return false}if(!MediaSource.isTypeSupported){return true}try{var o={};for(var a in r.info.meta.tracks){if(r.info.meta.tracks[a].type=="meta"){continue}if(!(r.info.meta.tracks[a].type in o)){o[r.info.meta.tracks[a].type]={}}o[r.info.meta.tracks[a].type][MistUtil.tracks.translateCodec(r.info.meta.tracks[a])]=1}var i=[];for(var l in o){var n=false;for(var s in o[l]){if(MediaSource.isTypeSupported('video/mp4;codecs="'+s+'"')){n=true;break}}if(n){i.push(l)}}t.supportedCodecs=i;return i.length?i:false}catch(e){}return false},player:function(){this.onreadylist=[]},scriptsrc:function(e){return e+"/flv.js"}};var p=mistplayers.flv.player;p.prototype=new MistPlayer;p.prototype.build=function(e,t){this.onFLVLoad=function(){if(e.destroyed){return}e.log("Building flv.js player..");var r=document.createElement("video");r.setAttribute("playsinline","");var o=["autoplay","loop","poster"];for(var a in o){var i=o[a];if(e.options[i]){r.setAttribute(i,e.options[i]===true?"":e.options[i])}}if(e.options.muted){r.muted=true}if(e.options.controls=="stock"){r.setAttribute("controls","")}if(e.info.type=="live"){r.loop=false}flvjs.LoggingControl.applyConfig({enableVerbose:false});flvjs.LoggingControl.addLogListener(function(t,r){e.log("[flvjs] "+r)});var l={type:"flv",url:e.source.url,hasAudio:false,hasVideo:false};for(var a in e.source.supportedCodecs){l["has"+e.source.supportedCodecs[a].charAt(0).toUpperCase()+e.source.supportedCodecs[a].slice(1)]=true}e.player.create=function(t){t=MistUtil.object.extend({},t);e.player.flvPlayer=flvjs.createPlayer(t,{lazyLoad:false});e.player.flvPlayer.attachMediaElement(r);e.player.flvPlayer.load();e.player.flvPlayer.play();if(!e.options.autoplay){r.pause()}};e.player.create(l);e.player.api={};function n(t){Object.defineProperty(e.player.api,t,{get:function(){return r[t]},set:function(e){return r[t]=e}})}var s=["volume","buffered","muted","loop","paused",,"error","textTracks","webkitDroppedFrameCount","webkitDecodedFrameCount"];if(e.info.type!="live"){s.push("duration")}else{Object.defineProperty(e.player.api,"duration",{get:function(){if(!r.buffered.length){return 0}return r.buffered.end(r.buffered.length-1)}})}for(var a in s){n(s[a])}function f(t){if(t in r){e.player.api[t]=function(){return r[t].call(r,arguments)}}}var s=["load","getVideoPlaybackQuality","play","pause"];for(var a in s){f(s[a])}e.player.api.setSource=function(t){if(t!=l.url&&t!=""){e.player.flvPlayer.unload();e.player.flvPlayer.detachMediaElement();e.player.flvPlayer.destroy();l.url=t;e.player.create(l)}};e.player.api.unload=function(){e.player.flvPlayer.unload();e.player.flvPlayer.detachMediaElement();e.player.flvPlayer.destroy()};e.player.setSize=function(e){r.style.width=e.width+"px";r.style.height=e.height+"px"};Object.defineProperty(e.player.api,"currentTime",{get:function(){return r.currentTime},set:function(t){var o=.5;for(var a=0;a<r.buffered.length;a++){if(t>=r.buffered.start(a)&&t<=r.buffered.end(a)-o){return r.currentTime=t}}e.log("Seek attempted outside of buffer, but MistServer does not support seeking in progressive flash. Setting to closest available instead");return r.currentTime=r.buffered.length?r.buffered.end(r.buffered.length-1)-o:0}});t(r)};if("flvjs"in window){this.onFLVLoad()}else{var r=MistUtil.scripts.insert(e.urlappend(mistplayers.flv.scriptsrc(e.options.host)),{onerror:function(t){var r="Failed to load flv.js";if(t.message){r+=": "+t.message}e.showError(r)},onload:e.player.onFLVLoad},e)}};
|
||||
mistplayers.flv={name:"HTML5 FLV Player",mimes:["flash/7"],priority:MistUtil.object.keys(mistplayers).length+1,isMimeSupported:function(e){return MistUtil.array.indexOf(this.mimes,e)==-1?false:true},isBrowserSupported:function(e,t,r){if(location.protocol!=MistUtil.http.url.split(t.url).protocol){if(location.protocol=="file:"&&MistUtil.http.url.split(t.url).protocol=="http:"){r.log("This page was loaded over file://, the player might not behave as intended.")}else{r.log("HTTP/HTTPS mismatch for this source");return false}}if(!window.MediaSource){return false}if(!MediaSource.isTypeSupported){return true}try{var o={};for(var a in r.info.meta.tracks){if(r.info.meta.tracks[a].type=="meta"){continue}if(!(r.info.meta.tracks[a].type in o)){o[r.info.meta.tracks[a].type]={}}o[r.info.meta.tracks[a].type][MistUtil.tracks.translateCodec(r.info.meta.tracks[a])]=1}var i=[];for(var l in o){var n=false;for(var s in o[l]){if(MediaSource.isTypeSupported('video/mp4;codecs="'+s+'"')){n=true;break}}if(n){i.push(l)}}t.supportedCodecs=i;return i.length?i:false}catch(e){}return false},player:function(){this.onreadylist=[]},scriptsrc:function(e){return e+"/flv.js"}};var p=mistplayers.flv.player;p.prototype=new MistPlayer;p.prototype.build=function(e,t){this.onFLVLoad=function(){if(e.destroyed){return}e.log("Building flv.js player..");var r=document.createElement("video");r.setAttribute("playsinline","");var o=["autoplay","loop","poster"];for(var a in o){var i=o[a];if(e.options[i]){r.setAttribute(i,e.options[i]===true?"":e.options[i])}}if(e.options.muted){r.muted=true}if(e.options.controls=="stock"){r.setAttribute("controls","")}if(e.info.type=="live"){r.loop=false}flvjs.LoggingControl.applyConfig({enableVerbose:false});flvjs.LoggingControl.addLogListener((function(t,r){e.log("[flvjs] "+r)}));var l={type:"flv",url:e.source.url,hasAudio:false,hasVideo:false};for(var a in e.source.supportedCodecs){l["has"+e.source.supportedCodecs[a].charAt(0).toUpperCase()+e.source.supportedCodecs[a].slice(1)]=true}e.player.create=function(t){t=MistUtil.object.extend({},t);e.player.flvPlayer=flvjs.createPlayer(t,{lazyLoad:false});e.player.flvPlayer.attachMediaElement(r);e.player.flvPlayer.load();e.player.flvPlayer.play();if(!e.options.autoplay){r.pause()}};e.player.create(l);e.player.api={};function n(t){Object.defineProperty(e.player.api,t,{get:function(){return r[t]},set:function(e){return r[t]=e}})}var s=["volume","buffered","muted","loop","paused",,"error","textTracks","webkitDroppedFrameCount","webkitDecodedFrameCount"];if(e.info.type!="live"){s.push("duration")}else{Object.defineProperty(e.player.api,"duration",{get:function(){if(!r.buffered.length){return 0}return r.buffered.end(r.buffered.length-1)}})}for(var a in s){n(s[a])}function f(t){if(t in r){e.player.api[t]=function(){return r[t].call(r,arguments)}}}var s=["load","getVideoPlaybackQuality","play","pause"];for(var a in s){f(s[a])}e.player.api.setSource=function(t){if(t!=l.url&&t!=""){e.player.flvPlayer.unload();e.player.flvPlayer.detachMediaElement();e.player.flvPlayer.destroy();l.url=t;e.player.create(l)}};e.player.api.unload=function(){e.player.flvPlayer.unload();e.player.flvPlayer.detachMediaElement();e.player.flvPlayer.destroy()};e.player.setSize=function(e){r.style.width=e.width+"px";r.style.height=e.height+"px"};Object.defineProperty(e.player.api,"currentTime",{get:function(){return r.currentTime},set:function(t){var o=.5;for(var a=0;a<r.buffered.length;a++){if(t>=r.buffered.start(a)&&t<=r.buffered.end(a)-o){return r.currentTime=t}}e.log("Seek attempted outside of buffer, but MistServer does not support seeking in progressive flash. Setting to closest available instead");return r.currentTime=r.buffered.length?r.buffered.end(r.buffered.length-1)-o:0}});t(r)};if("flvjs"in window){this.onFLVLoad()}else{var r=MistUtil.scripts.insert(e.urlappend(mistplayers.flv.scriptsrc(e.options.host)),{onerror:function(t){var r="Failed to load flv.js";if(t.message){r+=": "+t.message}e.showError(r)},onload:e.player.onFLVLoad},e)}};
|
|
@ -1 +1 @@
|
|||
mistplayers.hlsjs={name:"HLS.js player",mimes:["html5/application/vnd.apple.mpegurl","html5/application/vnd.apple.mpegurl;version=7"],priority:MistUtil.object.keys(mistplayers).length+1,isMimeSupported:function(t){return this.mimes.indexOf(t)==-1?false:true},isBrowserSupported:function(t,e,r){if(location.protocol!=MistUtil.http.url.split(e.url).protocol){r.log("HTTP/HTTPS mismatch for this source");return false}if(!("MediaSource"in window)){return false}if(!MediaSource.isTypeSupported){return true}var i={};var s=false;for(var o in r.info.meta.tracks){if(r.info.meta.tracks[o].type=="meta"){if(r.info.meta.tracks[o].codec=="subtitle"){s=true}continue}if(!(r.info.meta.tracks[o].type in i)){i[r.info.meta.tracks[o].type]={}}i[r.info.meta.tracks[o].type][MistUtil.tracks.translateCodec(r.info.meta.tracks[o])]=1}var a=[];for(var l in i){var n=false;for(var p in i[l]){if(MediaSource.isTypeSupported('video/mp4;codecs="'+p+'"')){n=true;break}}if(n){a.push(l)}}if(s){for(var o in r.info.source){if(r.info.source[o].type=="html5/text/vtt"){a.push("subtitle");break}}}return a.length?a:false},player:function(){},scriptsrc:function(t){return t+"/hlsjs.js"}};var p=mistplayers.hlsjs.player;p.prototype=new MistPlayer;p.prototype.build=function(t,e){var r=this;var i=document.createElement("video");i.setAttribute("playsinline","");var s=["autoplay","loop","poster"];for(var o in s){var a=s[o];if(t.options[a]){i.setAttribute(a,t.options[a]===true?"":t.options[a])}}if(t.options.muted){i.muted=true}if(t.info.type=="live"){i.loop=false}if(t.options.controls=="stock"){i.setAttribute("controls","")}i.setAttribute("crossorigin","anonymous");this.setSize=function(t){i.style.width=t.width+"px";i.style.height=t.height+"px"};this.api=i;t.player.api.unload=function(){if(t.player.hls){t.player.hls.destroy();t.player.hls=false;t.log("hls.js instance disposed")}};function l(e){t.player.hls=new Hls({maxBufferLength:15,maxMaxBufferLength:60});t.player.hls.attachMedia(i);t.player.hls.on(Hls.Events.MEDIA_ATTACHED,function(){t.player.hls.loadSource(e)})}t.player.api.setSource=function(e){if(!t.player.hls){return}if(t.player.hls.url!=e){t.player.hls.destroy();l(e)}};t.player.api.setSubtitle=function(t){var e=i.getElementsByTagName("track");for(var r=e.length-1;r>=0;r--){i.removeChild(e[r])}if(t){var s=document.createElement("track");i.appendChild(s);s.kind="subtitles";s.label=t.label;s.srclang=t.lang;s.src=t.src;s.setAttribute("default","")}};function n(){l(t.source.url)}if("Hls"in window){n()}else{var p=t.urlappend(mistplayers.hlsjs.scriptsrc(t.options.host));MistUtil.scripts.insert(p,{onerror:function(e){var r="Failed to load hlsjs.js";if(e.message){r+=": "+e.message}t.showError(r)},onload:n},t)}e(i)};
|
||||
mistplayers.hlsjs={name:"HLS.js player",mimes:["html5/application/vnd.apple.mpegurl","html5/application/vnd.apple.mpegurl;version=7"],priority:MistUtil.object.keys(mistplayers).length+1,isMimeSupported:function(t){return this.mimes.indexOf(t)==-1?false:true},isBrowserSupported:function(t,e,r){if(location.protocol!=MistUtil.http.url.split(e.url).protocol){r.log("HTTP/HTTPS mismatch for this source");return false}if(!("MediaSource"in window)){return false}if(!MediaSource.isTypeSupported){return true}var i={};var s=false;for(var o in r.info.meta.tracks){if(r.info.meta.tracks[o].type=="meta"){if(r.info.meta.tracks[o].codec=="subtitle"){s=true}continue}if(!(r.info.meta.tracks[o].type in i)){i[r.info.meta.tracks[o].type]={}}i[r.info.meta.tracks[o].type][MistUtil.tracks.translateCodec(r.info.meta.tracks[o])]=1}var a=[];for(var l in i){var n=false;for(var p in i[l]){if(MediaSource.isTypeSupported('video/mp4;codecs="'+p+'"')){n=true;break}}if(n){a.push(l)}}if(s){for(var o in r.info.source){if(r.info.source[o].type=="html5/text/vtt"){a.push("subtitle");break}}}return a.length?a:false},player:function(){},scriptsrc:function(t){return t+"/hlsjs.js"}};var p=mistplayers.hlsjs.player;p.prototype=new MistPlayer;p.prototype.build=function(t,e){var r=this;var i=document.createElement("video");i.setAttribute("playsinline","");var s=["autoplay","loop","poster"];for(var o in s){var a=s[o];if(t.options[a]){i.setAttribute(a,t.options[a]===true?"":t.options[a])}}if(t.options.muted){i.muted=true}if(t.info.type=="live"){i.loop=false}if(t.options.controls=="stock"){i.setAttribute("controls","")}i.setAttribute("crossorigin","anonymous");this.setSize=function(t){i.style.width=t.width+"px";i.style.height=t.height+"px"};this.api=i;t.player.api.unload=function(){if(t.player.hls){t.player.hls.destroy();t.player.hls=false;t.log("hls.js instance disposed")}};function l(e){t.player.hls=new Hls({maxBufferLength:15,maxMaxBufferLength:60});t.player.hls.attachMedia(i);t.player.hls.on(Hls.Events.MEDIA_ATTACHED,(function(){t.player.hls.loadSource(e)}))}t.player.api.setSource=function(e){if(!t.player.hls){return}if(t.player.hls.url!=e){t.player.hls.destroy();l(e)}};t.player.api.setSubtitle=function(t){var e=i.getElementsByTagName("track");for(var r=e.length-1;r>=0;r--){i.removeChild(e[r])}if(t){var s=document.createElement("track");i.appendChild(s);s.kind="subtitles";s.label=t.label;s.srclang=t.lang;s.src=t.src;s.setAttribute("default","")}};function n(){l(t.source.url)}if("Hls"in window){n()}else{var p=t.urlappend(mistplayers.hlsjs.scriptsrc(t.options.host));MistUtil.scripts.insert(p,{onerror:function(e){var r="Failed to load hlsjs.js";if(e.message){r+=": "+e.message}t.showError(r)},onload:n},t)}e(i)};
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -763,6 +763,7 @@ void Util::Config::addStandardPushCapabilities(JSON::Value &cap){
|
|||
pp["track_selectors"]["type"] = "group";
|
||||
pp["track_selectors"]["name"] = "Track selectors";
|
||||
pp["track_selectors"]["help"] = "Control which tracks are part of the output";
|
||||
pp["track_selectors"]["sort"] = "v";
|
||||
{
|
||||
JSON::Value & o = pp["track_selectors"]["options"];
|
||||
o["audio"]["name"] = "Audio track(s)";
|
||||
|
@ -787,6 +788,7 @@ void Util::Config::addStandardPushCapabilities(JSON::Value &cap){
|
|||
pp["trackwait_opts"]["type"] = "group";
|
||||
pp["trackwait_opts"]["name"] = "Wait for tracks";
|
||||
pp["trackwait_opts"]["help"] = "Before starting, ensure the available tracks satisfy certain conditions";
|
||||
pp["trackwait_opts"]["sort"] = "w";
|
||||
{
|
||||
JSON::Value & o = pp["trackwait_opts"]["options"];
|
||||
o["waittrackcount"]["name"] = "Wait for tracks count";
|
||||
|
@ -823,37 +825,10 @@ void Util::Config::addStandardPushCapabilities(JSON::Value &cap){
|
|||
o["maxwaittrackms"]["sort"] = "bdad";
|
||||
}
|
||||
|
||||
pp["pls_opts"]["type"] = "group";
|
||||
pp["pls_opts"]["name"] = "Playlist writing options";
|
||||
pp["pls_opts"]["help"] = "Control the writing of a playlist file when recording to a segmented format";
|
||||
{
|
||||
JSON::Value & o = pp["pls_opts"]["options"];
|
||||
o["noendlist"]["name"] = "Don't end playlist";
|
||||
o["noendlist"]["help"] = "If set, does not write #X-EXT-ENDLIST when finalizing the playlist on exit";
|
||||
o["noendlist"]["type"] = "bool";
|
||||
o["noendlist"]["format"] = "set_or_unset";
|
||||
o["noendlist"]["sort"] = "bfa";
|
||||
|
||||
o["m3u8"]["name"] = "Playlist path (relative to segments)";
|
||||
o["m3u8"]["help"] = "If set, will write a m3u8 playlist file for the segments to the given path (relative from the first segment path). When this parameter is used, at least one of the variables $segmentCounter or $currentMediaTime must be part of the segment path (to keep segments from overwriting each other). The \"Split interval\" parameter will default to 60 seconds when using this option.";
|
||||
o["m3u8"]["type"] = "string";
|
||||
o["m3u8"]["sort"] = "apa";
|
||||
|
||||
o["targetAge"]["name"] = "Playlist target age";
|
||||
o["targetAge"]["help"] = "When writing a playlist, delete segment entries that are more than this many seconds old from the playlist (and, if possible, also delete said segments themselves). When set to 0 or left empty, does not delete.";
|
||||
o["targetAge"]["type"] = "int";
|
||||
o["targetAge"]["unit"] = "s";
|
||||
o["targetAge"]["sort"] = "apb";
|
||||
|
||||
o["maxEntries"]["name"] = "Playlist max entries";
|
||||
o["maxEntries"]["help"] = "When writing a playlist, delete oldest segment entries once this entry count has been reached (and, if possible, also delete said segments themselves). When set to 0 or left empty, does not delete.";
|
||||
o["maxEntries"]["type"] = "int";
|
||||
o["maxEntries"]["sort"] = "apc";
|
||||
}
|
||||
|
||||
pp["time_opts"]["type"] = "group";
|
||||
pp["time_opts"]["name"] = "Timing options";
|
||||
pp["time_opts"]["help"] = "Control speed and the start/stop timing";
|
||||
pp["time_opts"]["sort"] = "x";
|
||||
{
|
||||
JSON::Value & o = pp["time_opts"]["options"];
|
||||
o["rate"]["name"] = "Playback rate";
|
||||
|
@ -917,17 +892,55 @@ void Util::Config::addStandardPushCapabilities(JSON::Value &cap){
|
|||
o["split"]["sort"] = "bh";
|
||||
}
|
||||
|
||||
pp["unmask"]["name"] = "Unmask tracks";
|
||||
pp["unmask"]["help"] = "If set to any value, removes any applied track masking before selecting tracks, acting as if no mask was applied at all";
|
||||
pp["unmask"]["type"] = "bool";
|
||||
pp["unmask"]["format"] = "set_or_unset";
|
||||
pp["unmask"]["sort"] = "bc";
|
||||
pp["pls_opts"]["type"] = "group";
|
||||
pp["pls_opts"]["name"] = "Playlist writing options";
|
||||
pp["pls_opts"]["help"] = "Control the writing of a playlist file when recording to a segmented format";
|
||||
pp["pls_opts"]["sort"] = "y";
|
||||
{
|
||||
JSON::Value & o = pp["pls_opts"]["options"];
|
||||
o["noendlist"]["name"] = "Don't end playlist";
|
||||
o["noendlist"]["help"] = "If set, does not write #X-EXT-ENDLIST when finalizing the playlist on exit";
|
||||
o["noendlist"]["type"] = "bool";
|
||||
o["noendlist"]["format"] = "set_or_unset";
|
||||
o["noendlist"]["sort"] = "bfa";
|
||||
|
||||
pp["append"]["name"] = "Append to file";
|
||||
pp["append"]["help"] = "If set to any value, will (if possible) append to an existing file, rather than overwriting it";
|
||||
pp["append"]["type"] = "bool";
|
||||
pp["append"]["format"] = "set_or_unset";
|
||||
pp["append"]["sort"] = "bf";
|
||||
o["m3u8"]["name"] = "Playlist path (relative to segments)";
|
||||
o["m3u8"]["help"] = "If set, will write a m3u8 playlist file for the segments to the given path (relative from the first segment path). When this parameter is used, at least one of the variables $segmentCounter or $currentMediaTime must be part of the segment path (to keep segments from overwriting each other). The \"Split interval\" parameter will default to 60 seconds when using this option.";
|
||||
o["m3u8"]["type"] = "string";
|
||||
o["m3u8"]["sort"] = "apa";
|
||||
|
||||
o["targetAge"]["name"] = "Playlist target age";
|
||||
o["targetAge"]["help"] = "When writing a playlist, delete segment entries that are more than this many seconds old from the playlist (and, if possible, also delete said segments themselves). When set to 0 or left empty, does not delete.";
|
||||
o["targetAge"]["type"] = "int";
|
||||
o["targetAge"]["unit"] = "s";
|
||||
o["targetAge"]["sort"] = "apb";
|
||||
|
||||
o["maxEntries"]["name"] = "Playlist max entries";
|
||||
o["maxEntries"]["help"] = "When writing a playlist, delete oldest segment entries once this entry count has been reached (and, if possible, also delete said segments themselves). When set to 0 or left empty, does not delete.";
|
||||
o["maxEntries"]["type"] = "int";
|
||||
o["maxEntries"]["sort"] = "apc";
|
||||
}
|
||||
|
||||
|
||||
|
||||
pp["misc_genopts"]["type"] = "group";
|
||||
pp["misc_genopts"]["name"] = "Miscellaneous options";
|
||||
pp["misc_genopts"]["sort"] = "z";
|
||||
{
|
||||
JSON::Value & o = pp["misc_genopts"]["options"];
|
||||
|
||||
o["unmask"]["name"] = "Unmask tracks";
|
||||
o["unmask"]["help"] = "If set to any value, removes any applied track masking before selecting tracks, acting as if no mask was applied at all";
|
||||
o["unmask"]["type"] = "bool";
|
||||
o["unmask"]["format"] = "set_or_unset";
|
||||
o["unmask"]["sort"] = "bc";
|
||||
|
||||
o["append"]["name"] = "Append to file";
|
||||
o["append"]["help"] = "If set to any value, will (if possible) append to an existing file, rather than overwriting it";
|
||||
o["append"]["type"] = "bool";
|
||||
o["append"]["format"] = "set_or_unset";
|
||||
o["append"]["sort"] = "bf";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
62
lsp/main.css
62
lsp/main.css
|
@ -637,6 +637,68 @@ input[type=radio] {
|
|||
margin-bottom: 1em;
|
||||
margin-left: 1em;
|
||||
}
|
||||
.input_container .itemgroup .input_container:first-child > b {
|
||||
cursor: pointer;
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
.input_container .itemgroup.expanded .input_container:first-child > b:before {
|
||||
content: '▼';
|
||||
}
|
||||
.input_container .itemgroup .input_container:first-child > b:before {
|
||||
content: '▲';
|
||||
color: var(--accentColor);
|
||||
opacity: 0.5;
|
||||
transform: translateY(-0.1em);
|
||||
display: inline-block;
|
||||
}
|
||||
.input_container .itemgroup .input_container:first-child:hover > b:before {
|
||||
opacity: 1;
|
||||
}
|
||||
.input_container .itemgroup .description {
|
||||
display: none;
|
||||
}
|
||||
.input_container .itemgroup.expanded .description {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.input_container .itemgroup .summary {
|
||||
font-size: 0.8em;
|
||||
margin: 0;
|
||||
padding-inline: 1.75em;
|
||||
}
|
||||
.input_container .itemgroup .summary li::marker {
|
||||
margin: 0 0.25em 0 0;
|
||||
}
|
||||
.input_container .itemgroup .summary:empty {
|
||||
display: flex;
|
||||
flex-flow: row wrap;
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
.input_container .itemgroup .summary:empty:after {
|
||||
content: '(Default settings)';
|
||||
}
|
||||
.input_container .itemgroup .summary:empty {
|
||||
opacity: 0.5;
|
||||
}
|
||||
.input_container .itemgroup.expanded .summary {
|
||||
display: none;
|
||||
}
|
||||
.input_container .itemgroup .UIelement {
|
||||
display: none;
|
||||
}
|
||||
.input_container .itemgroup.expanded .UIelement {
|
||||
display: flex;
|
||||
}
|
||||
.input_container .itemgroup:not(.expanded) .input_container:has(.summary:empty) {
|
||||
flex-direction: row;
|
||||
align-items: baseline;
|
||||
margin: 0;
|
||||
}
|
||||
.input_container .itemgroup.expanded .input_container {
|
||||
flex-direction: column;
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
.input_container .subitem {
|
||||
font-size: 0.9em;
|
||||
color: #777;
|
||||
|
|
133
lsp/minified.js
133
lsp/minified.js
|
@ -30,10 +30,10 @@ TS:-1,"TS.exe":-1},j;for(j in f){for(n in mist.data.config.protocols){var q=mist
|
|||
j.length&&(j[0].style.display="");g+=""==a?"STREAMNAME":a;break;case "TSSRT":case "TSSRT.exe":"srt://"==b.slice(0,6)?i?(g=parseURL(b.replace()),""==g.host&&(g=parseURL(b.replace(/^srt:\/\//,"http://localhost")),g.host=g.host.replace(/^localhost/,"")),g=""!=g.host&&(!g.search||!g.searchParams||"listener"!=g.searchParams.get("mode"))?"Caller mode: you should push to the other side.":g.search&&g.searchParams&&"caller"==g.searchParams.get("mode")?"Caller mode: you should probably add an address.":"srt://"+
|
||||
c.host+i):g="You must specify a port.":g="srt://"+c.host+j+"?streamid="+(""==a?"STREAMNAME":a);break;case "RTSP":case "RTSP.exe":g="rtsp://"+c.host+j+"/"+(""==a?"STREAMNAME":a)+(e?"?pass="+e:"");break;case "TS":case "TS.exe":g="udp://"+(""==l?c.host:l)+j+"/"}j=d.find(".field."+n.replace(".exe",""));j.length&&(j.setval(g).closest("label")[0].style.display="")}}},buildUI:function(a){var b=$("<div>").addClass("input_container"),d;for(d in a){var c=a[d];if(c instanceof jQuery)b.append(c);else if("help"==
|
||||
c.type){var e=$("<span>").addClass("text_container").append($("<span>").addClass("description").append(c.help));b.append(e);if("classes"in c)for(var l in c.classes)e.addClass(c.classes[l])}else if("text"==c.type)b.append($("<span>").addClass("text_container").append($("<span>").addClass("text").append(c.text)));else if("custom"==c.type)b.append(c.custom);else if("buttons"==c.type)for(l in e=$("<span>").addClass("button_container").on("keydown",function(a){a.stopPropagation()}),"css"in c&&e.css(c.css),
|
||||
b.append(e),c.buttons){var i=c.buttons[l],f=$("<button>").text(i.label).data("opts",i);"css"in i&&f.css(i.css);if("classes"in i)for(var m in i.classes)f.addClass(i.classes[m]);e.append(f);switch(i.type){case "cancel":f.addClass("cancel").click(i["function"]);break;case "save":f.addClass("save").click(function(){var a=$(this).data("opts").preSave;a&&a.call(this);var b=$(this).closest(".input_container"),c=!1;b.find('.hasValidate:visible, input[type="hidden"].hasValidate').each(function(){if(c=$(this).data("validate")(this,
|
||||
!0))return!1});(a=$(this).data("opts").failedValidate)&&a.call(this);c||(b.find('.isSetting:visible, input[type="hidden"].isSetting').each(function(){var a=$(this).getval(),b=$(this).data("pointer");if(""===a)if("default"in $(this).data("opts"))a=$(this).data("opts")["default"];else return b.main[b.index]=null,!0;b.main[b.index]=a;(a=$(this).data("opts").postSave)&&a.call(this)}),(a=$(this).data("opts")["function"])&&a(this))});break;default:f.click(i["function"])}}else{i=$("<label>").addClass("UIelement");
|
||||
b.append(i);"css"in c&&i.css(c.css);i.append($("<span>").addClass("label").html("label"in c?c.label+":":""));if("classes"in c)for(m in c.classes)i.addClass(c.classes[m]);f=$("<span>").addClass("field_container");i.append(f);switch(c.type){case "password":e=$("<input>").attr("type","password");break;case "int":e=$("<input>").attr("type","number");"min"in c&&e.attr("min",c.min);"max"in c&&e.attr("max",c.max);"step"in c&&e.attr("step",c.step);"validate"in c?c.validate.push("int"):c.validate=["int"];
|
||||
break;case "span":e=$("<span>");break;case "debug":c.select=[["","Default"],[0,"0 - All debugging messages disabled"],[1,"1 - Messages about failed operations"],[2,"2 - Previous level, and error messages"],[3,"3 - Previous level, and warning messages"],[4,"4 - Previous level, and status messages for development"],[5,"5 - Previous level, and more status messages for development"],[6,"6 - Previous level, and verbose debugging messages"],[7,"7 - Previous level, and very verbose debugging messages"],
|
||||
b.append(e),c.buttons){var i=c.buttons[l],f=$("<button>").text(i.label).data("opts",i);"css"in i&&f.css(i.css);if("classes"in i)for(var m in i.classes)f.addClass(i.classes[m]);e.append(f);switch(i.type){case "cancel":f.addClass("cancel").click(i["function"]);break;case "save":f.addClass("save").click(function(){var a=$(this).data("opts").preSave;a&&a.call(this);var b=$(this).closest(".input_container");b.find(".itemgroup:has(.summary:not(:empty))").addClass("expanded");var c=!1;b.find('.hasValidate:visible, input[type="hidden"].hasValidate').each(function(){if(c=
|
||||
$(this).data("validate")(this,!0))return!1});(a=$(this).data("opts").failedValidate)&&a.call(this);c||(b.find('.isSetting:visible, input[type="hidden"].isSetting').each(function(){var a=$(this).getval(),b=$(this).data("pointer");if(""===a)if("default"in $(this).data("opts"))a=$(this).data("opts")["default"];else return b.main[b.index]=null,!0;b.main[b.index]=a;(a=$(this).data("opts").postSave)&&a.call(this)}),(a=$(this).data("opts")["function"])&&a(this))});break;default:f.click(i["function"])}}else{i=
|
||||
$("<label>").addClass("UIelement");b.append(i);"css"in c&&i.css(c.css);i.append($("<span>").addClass("label").html("label"in c?c.label+":":""));if("classes"in c)for(m in c.classes)i.addClass(c.classes[m]);f=$("<span>").addClass("field_container");i.append(f);switch(c.type){case "password":e=$("<input>").attr("type","password");break;case "int":e=$("<input>").attr("type","number");"min"in c&&e.attr("min",c.min);"max"in c&&e.attr("max",c.max);"step"in c&&e.attr("step",c.step);"validate"in c?c.validate.push("int"):
|
||||
c.validate=["int"];break;case "span":e=$("<span>");break;case "debug":c.select=[["","Default"],[0,"0 - All debugging messages disabled"],[1,"1 - Messages about failed operations"],[2,"2 - Previous level, and error messages"],[3,"3 - Previous level, and warning messages"],[4,"4 - Previous level, and status messages for development"],[5,"5 - Previous level, and more status messages for development"],[6,"6 - Previous level, and verbose debugging messages"],[7,"7 - Previous level, and very verbose debugging messages"],
|
||||
[8,"8 - Report everything in extreme detail"],[9,"9 - Report everything in insane detail"],[10,"10 - All messages enabled"]];case "select":e=$("<select>");for(l in c.select){var n=$("<option>");"string"==typeof c.select[l]?n.text(c.select[l]):n.val(c.select[l][0]).text(c.select[l][1]);e.append(n)}break;case "textarea":e=$("<textarea>").on("keydown",function(a){a.stopPropagation()});break;case "checkbox":e=$("<input>").attr("type","checkbox");break;case "hidden":e=$("<input>").attr("type","hidden");
|
||||
i.hide();break;case "email":e=$("<input>").attr("type","email").attr("autocomplete","on").attr("required","");break;case "browse":e=$("<input>").attr("type","text");"filetypes"in c&&e.data("filetypes",c.filetypes);break;case "geolimited":case "hostlimited":e=$("<input>").attr("type","hidden");break;case "radioselect":e=$("<div>").addClass("radioselect");for(d in c.radioselect){var j=$("<input>").attr("type","radio").val(c.radioselect[d][0]).attr("name",c.label);c.readonly&&j.prop("disabled",!0);n=
|
||||
$("<label>").append(j).append($("<span>").html(c.radioselect[d][1]));e.append(n);if(2<c.radioselect[d].length)for(l in j=$("<select>").change(function(){$(this).parent().find("input[type=radio]:enabled").prop("checked","true")}),n.append(j),c.readonly&&j.prop("disabled",!0),c.radioselect[d][2])n=$("<option>"),j.append(n),c.radioselect[d][2][l]instanceof Array?n.val(c.radioselect[d][2][l][0]).html(c.radioselect[d][2][l][1]):n.html(c.radioselect[d][2][l])}break;case "checklist":e=$("<div>").addClass("checkcontainer");
|
||||
|
@ -104,12 +104,12 @@ $("<table>").css("text-indent","0");j.html(s);s.append($("<tr>").append($("<th>"
|
|||
h.amount:"∞")))}else j.text("None. ");j.append($("<a>").text("More details").attr("href","https://shop.mistserver.org/myinvoices").attr("target","_blank"))}}else l.text("");p=function(){var a={totals:{fields:["clients"],start:-10},active_streams:true};if(!("capabilities"in mist.data))a.capabilities=true;mist.send(function(){ca()},a)};var ca=function(){i.text("active_streams"in mist.data?mist.data.active_streams?mist.data.active_streams.length:0:"?");if("totals"in mist.data&&"all_streams"in mist.data.totals)var a=
|
||||
mist.data.totals.all_streams.all_protocols.clients,a=a.length?UI.format.number(a[a.length-1][1]):0;else a="Loading..";m.text(a);n.text(UI.format.dateTime(mist.data.config.time,"long"));f.html("");a=0;"license"in mist.data.config&&"user_msg"in mist.data.config.license&&mist.data.log.unshift([mist.data.config.license.time,"ERROR",mist.data.config.license.user_msg]);for(var b in mist.data.log){var c=mist.data.log[b];if(["FAIL","ERROR"].indexOf(c[1])>-1){a++;var d=$("<span>").addClass("content").addClass("red"),
|
||||
h=c[2].split("|");for(b in h)d.append($("<span>").text(h[b]));f.append($("<div>").append($("<span>").append(UI.format.time(c[0]))).append(d));if(a==5)break}}a==0&&f.html("None.");a=[];c=[];for(b in mist.data.config.protocols){d=mist.data.config.protocols[b];a.indexOf(d.connector)>-1||a.push(d.connector)}q.text(a.length?a.join(", "):"None.");if("capabilities"in mist.data){for(b in mist.data.capabilities.connectors)a.indexOf(b)==-1&&c.push(b);g.text(c.length?c.join(", "):"None.")}else g.text("Loading..")};
|
||||
p();ca();UI.interval.set(p,3E4);break;case "General":var G={serverid:mist.data.config.serverid,debug:mist.data.config.debug,accesslog:mist.data.config.accesslog,prometheus:mist.data.config.prometheus,defaultStream:mist.data.config.defaultStream,trustedproxy:mist.data.config.trustedproxy},H={sessionViewerMode:mist.data.config.sessionViewerMode,sessionInputMode:mist.data.config.sessionInputMode,sessionOutputMode:mist.data.config.sessionOutputMode,sessionUnspecifiedMode:mist.data.config.sessionUnspecifiedMode,
|
||||
tknMode:mist.data.config.tknMode,sessionStreamInfoMode:mist.data.config.sessionStreamInfoMode},P={location:"location"in mist.data.config?mist.data.config.location:{}},x={limit:""};"bandwidth"in mist.data&&(x=mist.data.bandwidth,null==x&&(x={}),x.limit||(x.limit=""));var da=$("<select>").html($("<option>").val(1).text("bytes/s")).append($("<option>").val(1024).text("KiB/s")).append($("<option>").val(1048576).text("MiB/s")).append($("<option>").val(1073741824).text("GiB/s"));c.html(UI.buildUI([$("<h2>").text("General settings"),
|
||||
{type:"help",help:"These are settings that apply to your MistServer instance in general."},{type:"str",label:"Human readable name",pointer:{main:G,index:"serverid"},help:"You can name your MistServer here for personal use. You'll still need to set host name within your network yourself."},{type:"debug",label:"Debug level",pointer:{main:G,index:"debug"},help:"You can set the amount of debug information MistServer saves in the log. A full reboot of MistServer is required before some components of MistServer can post debug information."},
|
||||
{type:"selectinput",label:"Access log",selectinput:[["","Do not track"],["LOG","Log to MistServer log"],[{type:"str",label:"Path",LTSonly:!0},"Log to file"]],pointer:{main:G,index:"accesslog"},help:"Enable access logs.",LTSonly:!0},{type:"selectinput",label:"Prometheus stats output",selectinput:[["","Disabled"],[{type:"str",label:"Passphrase",LTSonly:!0},"Enabled"]],pointer:{main:G,index:"prometheus"},help:"Make stats available in Prometheus format. These can be accessed via "+h+"/PASSPHRASE or "+
|
||||
h+"/PASSPHRASE.json.",LTSonly:!0},{type:"inputlist",label:"Trusted proxies",help:"List of proxy server addresses that are allowed to override the viewer IP address to arbitrary values.<br>You may use a hostname or IP address.",pointer:{main:G,index:"trustedproxy"}},{type:"str",validate:["streamname_with_wildcard_and_variables"],label:"Fallback stream",pointer:{main:G,index:"defaultStream"},help:"When this is set, if someone attempts to view a stream that does not exist, or is offline, they will be redirected to this stream instead. $stream may be used to refer to the original stream name.",
|
||||
LTSonly:!0},{type:"buttons",buttons:[{type:"save",label:"Save","function":function(a){$(a).text("Saving..");mist.send(function(){UI.navto("General")},{config:G})}}]}]));c.append(UI.buildUI([$("<h3>").text("Sessions"),{type:"bitmask",label:"Bundle viewer sessions by",bitmask:[[8,"Stream name"],[4,"IP address"],[2,"Token"],[1,"Protocol"]],pointer:{main:H,index:"sessionViewerMode"},help:"Change the way viewer connections are bundled into sessions.<br>Default: stream name, viewer IP and token"},{type:"bitmask",
|
||||
p();ca();UI.interval.set(p,3E4);break;case "General":var A={serverid:mist.data.config.serverid,debug:mist.data.config.debug,accesslog:mist.data.config.accesslog,prometheus:mist.data.config.prometheus,defaultStream:mist.data.config.defaultStream,trustedproxy:mist.data.config.trustedproxy},H={sessionViewerMode:mist.data.config.sessionViewerMode,sessionInputMode:mist.data.config.sessionInputMode,sessionOutputMode:mist.data.config.sessionOutputMode,sessionUnspecifiedMode:mist.data.config.sessionUnspecifiedMode,
|
||||
tknMode:mist.data.config.tknMode,sessionStreamInfoMode:mist.data.config.sessionStreamInfoMode},P={location:"location"in mist.data.config?mist.data.config.location:{}},D={limit:""};"bandwidth"in mist.data&&(D=mist.data.bandwidth,null==D&&(D={}),D.limit||(D.limit=""));var da=$("<select>").html($("<option>").val(1).text("bytes/s")).append($("<option>").val(1024).text("KiB/s")).append($("<option>").val(1048576).text("MiB/s")).append($("<option>").val(1073741824).text("GiB/s"));c.html(UI.buildUI([$("<h2>").text("General settings"),
|
||||
{type:"help",help:"These are settings that apply to your MistServer instance in general."},{type:"str",label:"Human readable name",pointer:{main:A,index:"serverid"},help:"You can name your MistServer here for personal use. You'll still need to set host name within your network yourself."},{type:"debug",label:"Debug level",pointer:{main:A,index:"debug"},help:"You can set the amount of debug information MistServer saves in the log. A full reboot of MistServer is required before some components of MistServer can post debug information."},
|
||||
{type:"selectinput",label:"Access log",selectinput:[["","Do not track"],["LOG","Log to MistServer log"],[{type:"str",label:"Path",LTSonly:!0},"Log to file"]],pointer:{main:A,index:"accesslog"},help:"Enable access logs.",LTSonly:!0},{type:"selectinput",label:"Prometheus stats output",selectinput:[["","Disabled"],[{type:"str",label:"Passphrase",LTSonly:!0},"Enabled"]],pointer:{main:A,index:"prometheus"},help:"Make stats available in Prometheus format. These can be accessed via "+h+"/PASSPHRASE or "+
|
||||
h+"/PASSPHRASE.json.",LTSonly:!0},{type:"inputlist",label:"Trusted proxies",help:"List of proxy server addresses that are allowed to override the viewer IP address to arbitrary values.<br>You may use a hostname or IP address.",pointer:{main:A,index:"trustedproxy"}},{type:"str",validate:["streamname_with_wildcard_and_variables"],label:"Fallback stream",pointer:{main:A,index:"defaultStream"},help:"When this is set, if someone attempts to view a stream that does not exist, or is offline, they will be redirected to this stream instead. $stream may be used to refer to the original stream name.",
|
||||
LTSonly:!0},{type:"buttons",buttons:[{type:"save",label:"Save","function":function(a){$(a).text("Saving..");mist.send(function(){UI.navto("General")},{config:A})}}]}]));c.append(UI.buildUI([$("<h3>").text("Sessions"),{type:"bitmask",label:"Bundle viewer sessions by",bitmask:[[8,"Stream name"],[4,"IP address"],[2,"Token"],[1,"Protocol"]],pointer:{main:H,index:"sessionViewerMode"},help:"Change the way viewer connections are bundled into sessions.<br>Default: stream name, viewer IP and token"},{type:"bitmask",
|
||||
label:"Bundle input sessions by",bitmask:[[8,"Stream name"],[4,"IP address"],[2,"Token"],[1,"Protocol"]],pointer:{main:H,index:"sessionInputMode"},help:"Change the way input connections are bundled into sessions.<br>Default: stream name, input IP, token and protocol"},{type:"bitmask",label:"Bundle output sessions by",bitmask:[[8,"Stream name"],[4,"IP address"],[2,"Token"],[1,"Protocol"]],pointer:{main:H,index:"sessionOutputMode"},help:"Change the way output connections are bundled into sessions.<br>Default: stream name, output IP, token and protocol"},
|
||||
{type:"bitmask",label:"Bundle unspecified sessions by",bitmask:[[8,"Stream name"],[4,"IP address"],[2,"Token"],[1,"Protocol"]],pointer:{main:H,index:"sessionUnspecifiedMode"},help:"Change the way unspecified connections are bundled into sessions.<br>Default: none"},{type:"select",label:"Treat HTTP-only sessions as",select:[[1,"A viewer session"],[2,"An output session: skip executing the USER_NEW and USER_END triggers"],[4,"A separate 'unspecified' session: skip executing the USER_NEW and USER_END triggers"],
|
||||
[3,"Do not start a session: skip executing the USER_NEW and USER_END triggers and do not count for statistics"]],pointer:{main:H,index:"sessionStreamInfoMode"},help:"Change the way the stream info connection gets treated.<br>Default: as a viewer session"},{type:"bitmask",label:"Communicate session token",bitmask:[[8,"Write to cookie"],[4,"Write to URL parameter"],[2,"Read from cookie"],[1,"Read from URL parameter"]],pointer:{main:H,index:"tknMode"},help:"Change the way the session token gets passed to and from MistServer, which can be set as a cookie or URL parameter named `tkn`. Reading the session token as a URL parameter takes precedence over reading from the cookie.<br>Default: all"},
|
||||
|
@ -117,25 +117,25 @@ label:"Bundle input sessions by",bitmask:[[8,"Stream name"],[4,"IP address"],[2,
|
|||
for(var c in a.variable_list){var d=a.variable_list[c];b.append($("<tr>").addClass("variable").attr("data-name",c).html($("<td>").text("$"+c)).append($("<td>").html($("<code>").text(typeof d=="string"?JSON.stringify(d):d[2]>0?JSON.stringify(d[3]):""))).append($("<td>").text(typeof d=="string"?"":d[0])).append($("<td>").html(typeof d=="string"?"Never":d[1]==0?"Once":UI.format.duration(d[1]))).append($("<td>").attr("title",d[2]>0?typeof d=="string"?"":"At "+UI.format.dateTime(new Date(d[2]),"long"):
|
||||
"Not yet").html(typeof d=="string"?"":d[2]>0?UI.format.duration((new Date).getTime()*0.001-d[2])+" ago":"Not yet")).append($("<td>").html($("<button>").text("Edit").click(function(){var a=$(this).closest("tr").attr("data-name");UI.navto("Edit variable",a)})).append($("<button>").text("Remove").click(function(){var a=$(this).closest("tr").attr("data-name");confirm("Are you sure you want to remove the custom variable $"+a+"?")&&mist.send(function(){UI.showTab("General")},{variable_remove:a})}))))}}else S.html("None configured.")},
|
||||
{variable_list:!0});c.append(UI.buildUI([$("<h3>").text("Custom variables"),{type:"help",help:"In certain places, like target URL's and pushes, variable substitution is applied in order to replace a $variable with their corresponding value. Here you can define your own constants and variables which will be used when variable substitution is applied. Variables can be used within variables but will not be reflected in their latest value on this page."},$("<div>").addClass("button_container").css("text-align",
|
||||
"right").html($("<button>").text("New variable").click(function(){UI.navto("Edit variable","")})),S]));c.append(UI.buildUI([$("<h3>").text("Load balancer"),{type:"help",help:"If you're using MistServer's load balancer, the information below is passed to it so that it can make informed decisions."},{type:"selectinput",label:"Server's bandwidth limit",selectinput:[["","Default (1 gbps)"],[{label:"Custom",type:"int",min:0,unit:da},"Custom"]],pointer:{main:x,index:"limit"},help:"This is the amount of traffic this server is willing to handle."},
|
||||
{type:"inputlist",label:"Bandwidth exceptions",pointer:{main:x,index:"exceptions"},help:"Data sent to the hosts and subnets listed here will not count towards reported bandwidth usage.<br>Examples:<ul><li>192.168.0.0/16</li><li>localhost</li><li>10.0.0.0/8</li><li>fe80::/16</li></ul>"},{type:"int",step:1E-8,label:"Server latitude",pointer:{main:P.location,index:"lat"},help:"This setting is only useful when MistServer is combined with a load balancer. When this is set, the balancer can send users to a server close to them."},
|
||||
"right").html($("<button>").text("New variable").click(function(){UI.navto("Edit variable","")})),S]));c.append(UI.buildUI([$("<h3>").text("Load balancer"),{type:"help",help:"If you're using MistServer's load balancer, the information below is passed to it so that it can make informed decisions."},{type:"selectinput",label:"Server's bandwidth limit",selectinput:[["","Default (1 gbps)"],[{label:"Custom",type:"int",min:0,unit:da},"Custom"]],pointer:{main:D,index:"limit"},help:"This is the amount of traffic this server is willing to handle."},
|
||||
{type:"inputlist",label:"Bandwidth exceptions",pointer:{main:D,index:"exceptions"},help:"Data sent to the hosts and subnets listed here will not count towards reported bandwidth usage.<br>Examples:<ul><li>192.168.0.0/16</li><li>localhost</li><li>10.0.0.0/8</li><li>fe80::/16</li></ul>"},{type:"int",step:1E-8,label:"Server latitude",pointer:{main:P.location,index:"lat"},help:"This setting is only useful when MistServer is combined with a load balancer. When this is set, the balancer can send users to a server close to them."},
|
||||
{type:"int",step:1E-8,label:"Server longitude",pointer:{main:P.location,index:"lon"},help:"This setting is only useful when MistServer is combined with a load balancer. When this is set, the balancer can send users to a server close to them."},{type:"str",label:"Server location name",pointer:{main:P.location,index:"name"},help:"This setting is only useful when MistServer is combined with a load balancer. This will be displayed as the server's location."},{type:"buttons",buttons:[{type:"save",label:"Save",
|
||||
"function":function(a){$(a).text("Saving..");var a={config:P},b={};b.limit=x.limit?da.val()*x.limit:0;b.exceptions=x.exceptions;if(b.exceptions===null)b.exceptions=[];a.bandwidth=b;mist.send(function(){UI.navto("Overview")},a)}}]}]));var C=$("<div>").html("Loading..");c.append(UI.buildUI([$("<h3>").text("External writers"),{type:"help",help:"When pushing a stream to a target unsupported by MistServer like S3 storage, an external writer can be provided which handles writing the media data to the target location. The writer will receive data over stdin and MistServer will print any info written to stdout and stderr as log messages."},
|
||||
"function":function(a){$(a).text("Saving..");var a={config:P},b={};b.limit=D.limit?da.val()*D.limit:0;b.exceptions=D.exceptions;if(b.exceptions===null)b.exceptions=[];a.bandwidth=b;mist.send(function(){UI.navto("Overview")},a)}}]}]));var C=$("<div>").html("Loading..");c.append(UI.buildUI([$("<h3>").text("External writers"),{type:"help",help:"When pushing a stream to a target unsupported by MistServer like S3 storage, an external writer can be provided which handles writing the media data to the target location. The writer will receive data over stdin and MistServer will print any info written to stdout and stderr as log messages."},
|
||||
$("<div>").addClass("button_container").css("text-align","right").html($("<button>").text("New external writer").click(function(){UI.navto("Edit external writer","")})),C]));mist.send(function(a){if(a.external_writer_list){var b=$("<tbody>");C.html($("<table>").html($("<thead>").html($("<tr>").append($("<th>").text("Name")).append($("<th>").text("Command line")).append($("<th>").text("URI protocols handled")).append($("<th>")))).append(b));for(var c in a.external_writer_list){var d=a.external_writer_list[c];
|
||||
b.append($("<tr>").addClass("uploader").attr("data-name",c).html($("<td>").text(d[0])).append($("<td>").html($("<code>").html(d[1]))).append($("<td>").text(d[2]?d[2].join(", "):"none").addClass("desc")).append($("<td>").html($("<button>").text("Edit").click(function(){var a=$(this).closest("tr").attr("data-name");UI.navto("Edit external writer",a)})).append($("<button>").text("Remove").click(function(){var b=$(this).closest("tr").attr("data-name"),b=a.external_writer_list[b][0];confirm("Are you sure you want to remove the Uploader '"+
|
||||
b+"'?")&&mist.send(function(){UI.showTab("General")},{external_writer_remove:b})}))))}}else C.html("None configured.")},{external_writer_list:!0});break;case "Edit external writer":var u=!1;""!=b&&(u=!0);var D=function(){u?c.html($("<h2>").text("Edit external writer '"+b+"'")):c.html($("<h2>").text("New external writer"));var a={};if(mist.data.external_writer_list&&b in mist.data.external_writer_list){var d=mist.data.external_writer_list[b];a.name=d[0];a.cmdline=d[1];a.protocols=d[2]}c.append(UI.buildUI([{type:"str",
|
||||
b+"'?")&&mist.send(function(){UI.showTab("General")},{external_writer_remove:b})}))))}}else C.html("None configured.")},{external_writer_list:!0});break;case "Edit external writer":var u=!1;""!=b&&(u=!0);var E=function(){u?c.html($("<h2>").text("Edit external writer '"+b+"'")):c.html($("<h2>").text("New external writer"));var a={};if(mist.data.external_writer_list&&b in mist.data.external_writer_list){var d=mist.data.external_writer_list[b];a.name=d[0];a.cmdline=d[1];a.protocols=d[2]}c.append(UI.buildUI([{type:"str",
|
||||
label:"Human readable name",help:"A human readable name for the external writer.",validate:["required"],pointer:{main:a,index:"name"}},{type:"str",label:"Command line",help:"Command line for a local command (with optional arguments) which will write media data to the target.",validate:["required"],pointer:{main:a,index:"cmdline"}},{type:"inputlist",label:"URI protocols handled",help:"URI protocols which the external writer will be handling.",validate:["required",function(a){for(var b in a){var c=
|
||||
a[b];if(c.match(/^([a-z\d\+\-\.])+?$/)===null)return{classes:["red"],msg:"There was a problem with the protocol URI '"+$("<div>").text(c).html()+"':<br>A protocol URI may only contain lower case letters, digits, and the following special characters . + and -"}}}],input:{type:"str",unit:"://"},pointer:{main:a,index:"protocols"}},{type:"buttons",buttons:[{type:"cancel",label:"Cancel","function":function(){UI.navto("General")}},{type:"save",label:"Save","function":function(){var c={external_writer_add:a},
|
||||
d=null;b!=""&&b in mist.data.external_writer_list&&(d=mist.data.external_writer_list[b][0]);if(d!==null&&a.name!=d)c.external_writer_remove=d;mist.send(function(){UI.navto("General")},c)}}]}]))};"external_writer_list"in mist.data?D():mist.send(function(){D()},{external_writer_list:!0});break;case "Edit variable":u=!1;""!=b&&(u=!0);var v=function(a,d){u?c.html($("<h2>").text('Edit Variable "$'+b+'"')):c.html($("<h2>").text("New Variable"));var h=$("<div>");c.append(UI.buildUI([{type:"str",maxlength:31,
|
||||
d=null;b!=""&&b in mist.data.external_writer_list&&(d=mist.data.external_writer_list[b][0]);if(d!==null&&a.name!=d)c.external_writer_remove=d;mist.send(function(){UI.navto("General")},c)}}]}]))};"external_writer_list"in mist.data?E():mist.send(function(){E()},{external_writer_list:!0});break;case "Edit variable":u=!1;""!=b&&(u=!0);var v=function(a,d){u?c.html($("<h2>").text('Edit Variable "$'+b+'"')):c.html($("<h2>").text("New Variable"));var h=$("<div>");c.append(UI.buildUI([{type:"str",maxlength:31,
|
||||
label:"Variable name",prefix:"$",help:"What should the variable be called? A dollar sign will automatically be prepended.",pointer:{main:a,index:"name"},validate:["required",function(a){if(a.length&&a[0]=="$")return{msg:"The dollar sign will automatically be prepended. You don't need to type it here.",classes:["red"]};if(a.indexOf("{")!==-1||a.indexOf("}")!==-1||a.indexOf("$")!==-1)return{msg:'The following symbols are not permitted: "$ { }".',classes:["red"]}}]},{type:"select",label:"Type",help:"What kind of variable is this? It can either be a static value that you can enter below, or a dynamic one that is returned by a command.",
|
||||
select:[["value","Static value"],["command","Dynamic through command"]],value:"value",pointer:{main:d,index:"type"},"function":function(){var a=[$("Invalid variable type")];switch($(this).val()){case "value":a=[{type:"str",label:"Value",pointer:{main:d,index:"value"},help:"The static value that this variable should be replaced with. There is a character limit of 63 characters.",validate:["required"]}];break;case "command":a=[{type:"str",label:"Command",help:"The command that should be executed to retrieve the value for this variable.<br>For example:<br><code>/usr/bin/date +%A</code><br>There is a character limit of 511 characters.",
|
||||
validate:["required"],pointer:{main:d,index:"target"}},{type:"int",min:0,max:4294967295,"default":0,label:"Checking interval",unit:"s",help:"At what interval, in seconds, MistServer should execute the command and update the value.<br>To execute the command once when MistServer starts up (and then never update), set the interval to 0.",pointer:{main:d,index:"interval"}},{type:"int",min:0,max:4294967295,"default":1,label:"Wait time",unit:"s",help:"Specifies the maximum time, in seconds, MistServer should wait for data when executing the variable target. If set to 0 this variable takes on the same value as the interval.<br>MistServer only updates one variable at a time, so setting this value too high can block other variables from updating.",
|
||||
pointer:{main:d,index:"waitTime"}}]}h.html(UI.buildUI(a))}},h,{type:"buttons",buttons:[{type:"cancel",label:"Cancel","function":function(){UI.navto("General")}},{type:"save",label:"Save","function":function(){var c={variable_add:a};switch(d.type){case "value":a.value=d.value;break;case "command":a.target=d.target;a.interval=d.interval;a.waitTime=d.waitTime}if(a.name!=b)c.variable_remove=b;mist.send(function(){UI.navto("General")},c)}}]}]))};c.html("Loading..");u?mist.send(function(a){if(b in a.variable_list){a=
|
||||
a.variable_list[b];v({name:b},typeof a=="string"?{value:a,type:"value"}:{target:a[0],interval:a[1],waitTime:a[4],type:"command"})}else c.append('Variable "$'+b+'" does not exist.')},{variable_list:!0}):v({},{});break;case "Protocols":if("undefined"==typeof mist.data.capabilities){mist.send(function(){UI.navto(a)},{capabilities:!0});c.append("Loading..");return}var A=$("<tbody>");c.append(UI.buildUI([{type:"help",help:"You can find an overview of all the protocols and their relevant information here. You can add, edit or delete protocols."}])).append($("<button>").text("Delete all protocols").click(function(){if(confirm("Are you sure you want to delete all currently configured protocols?")){mist.data.config.protocols=
|
||||
a.variable_list[b];v({name:b},typeof a=="string"?{value:a,type:"value"}:{target:a[0],interval:a[1],waitTime:a[4],type:"command"})}else c.append('Variable "$'+b+'" does not exist.')},{variable_list:!0}):v({},{});break;case "Protocols":if("undefined"==typeof mist.data.capabilities){mist.send(function(){UI.navto(a)},{capabilities:!0});c.append("Loading..");return}var z=$("<tbody>");c.append(UI.buildUI([{type:"help",help:"You can find an overview of all the protocols and their relevant information here. You can add, edit or delete protocols."}])).append($("<button>").text("Delete all protocols").click(function(){if(confirm("Are you sure you want to delete all currently configured protocols?")){mist.data.config.protocols=
|
||||
[];mist.send(function(){UI.navto("Protocols")},{config:mist.data.config})}})).append($("<button>").text("Enable default protocols").click(function(){var a=Object.keys(mist.data.capabilities.connectors),b;for(b in mist.data.config.protocols){var c=a.indexOf(mist.data.config.protocols[b].connector);c>-1&&a.splice(c,1)}var d=[];for(b in a)(!("required"in mist.data.capabilities.connectors[a[b]])||Object.keys(mist.data.capabilities.connectors[a[b]].required).length==0)&&d.push(a[b]);c="Click OK to enable disabled protocols with their default settings:\n ";
|
||||
c=d.length?c+d.join(", "):c+"None.";if(d.length!=a.length){a=a.filter(function(a){return d.indexOf(a)<0});c=c+("\n\nThe following protocols can only be set manually:\n "+a.join(", "))}if(confirm(c)&&d.length){if(mist.data.config.protocols===null)mist.data.config.protocols=[];for(b in d)mist.data.config.protocols.push({connector:d[b]});mist.send(function(){UI.navto("Protocols")},{config:mist.data.config})}})).append("<br>").append($("<button>").text("New protocol").click(function(){UI.navto("Edit Protocol")}).css("clear",
|
||||
"both")).append($("<table>").html($("<thead>").html($("<tr>").html($("<th>").text("Protocol")).append($("<th>").text("Status")).append($("<th>").text("Settings")).append($("<th>")))).append(A));var L=function(){function a(b){var c=mist.data.capabilities.connectors[b.connector];if(!c)return"";var d=[],h=["required","optional"],e;for(e in h)for(var g in c[h[e]])b[g]&&b[g]!=""?d.push(g+": "+b[g]):c[h[e]][g]["default"]&&d.push(g+": "+c[h[e]][g]["default"]);return $("<span>").addClass("description").text(d.join(", "))}
|
||||
A.html("");for(var b in mist.data.config.protocols){var c=mist.data.config.protocols[b],d=mist.data.capabilities.connectors[c.connector];A.append($("<tr>").data("index",b).append($("<td>").text(d&&d.friendly?d.friendly:c.connector)).append($("<td>").html(UI.format.status(c))).append($("<td>").html(a(c))).append($("<td>").css("text-align","right").html($("<button>").text("Edit").click(function(){UI.navto("Edit Protocol",$(this).closest("tr").data("index"))})).append($("<button>").text("Delete").click(function(){var a=
|
||||
"both")).append($("<table>").html($("<thead>").html($("<tr>").html($("<th>").text("Protocol")).append($("<th>").text("Status")).append($("<th>").text("Settings")).append($("<th>")))).append(z));var L=function(){function a(b){var c=mist.data.capabilities.connectors[b.connector];if(!c)return"";var d=[],h=["required","optional"],e;for(e in h)for(var g in c[h[e]])b[g]&&b[g]!=""?d.push(g+": "+b[g]):c[h[e]][g]["default"]&&d.push(g+": "+c[h[e]][g]["default"]);return $("<span>").addClass("description").text(d.join(", "))}
|
||||
z.html("");for(var b in mist.data.config.protocols){var c=mist.data.config.protocols[b],d=mist.data.capabilities.connectors[c.connector];z.append($("<tr>").data("index",b).append($("<td>").text(d&&d.friendly?d.friendly:c.connector)).append($("<td>").html(UI.format.status(c))).append($("<td>").html(a(c))).append($("<td>").css("text-align","right").html($("<button>").text("Edit").click(function(){UI.navto("Edit Protocol",$(this).closest("tr").data("index"))})).append($("<button>").text("Delete").click(function(){var a=
|
||||
$(this).closest("tr").data("index");if(confirm('Are you sure you want to delete the protocol "'+mist.data.config.protocols[a].connector+'"?')){mist.send(function(){UI.navto("Protocols")},{deleteprotocol:mist.data.config.protocols[a]});mist.data.config.protocols.splice(a,1)}}))))}};L();UI.interval.set(function(){mist.send(function(){L()})},1E4);break;case "Edit Protocol":if("undefined"==typeof mist.data.capabilities){mist.send(function(){UI.navto(a,b)},{capabilities:!0});c.append("Loading..");return}u=
|
||||
!1;""!=b&&0<=b&&(u=!0);var M={};for(p in mist.data.config.protocols)M[mist.data.config.protocols[p].connector]=1;var ea=function(a){var b=mist.data.capabilities.connectors[a],c=mist.convertBuildOptions(b,r);if(u)var d=$.extend({},r);c.push({type:"hidden",pointer:{main:r,index:"connector"},value:a});c.push({type:"buttons",buttons:[{type:"save",label:"Save","function":function(){var a={};u?a.updateprotocol=[d,r]:a.addprotocol=r;mist.send(function(){UI.navto("Protocols")},a)}},{type:"cancel",label:"Cancel",
|
||||
"function":function(){UI.navto("Protocols")}}]});if("deps"in b&&b.deps!=""){s=$("<span>").text("Dependencies:");$ul=$("<ul>");s.append($ul);if(typeof b.deps=="string")b.deps=b.deps.split(", ");for(var h in b.deps){a=$("<li>").text(b.deps[h]+" ");$ul.append(a);typeof M[b.deps[h]]!="undefined"||typeof M[b.deps[h]+".exe"]!="undefined"?a.append($("<span>").addClass("green").text("(Configured)")):a.append($("<span>").addClass("red").text("(Not yet configured)"))}c.unshift({type:"text",text:s[0].innerHTML})}return UI.buildUI(c)},
|
||||
|
@ -169,27 +169,27 @@ d)){g=e;break}if(g===null){Q.html($("<h3>").text("Unrecognized input").addClass(
|
|||
switch(f.name){case "Buffer":case "Buffer.exe":g.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"});g.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"});g.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"});
|
||||
g.push({label:"SRT",type:"span",clipboard:true,readonly:true,classes:["TSSRT"]});g.push({label:"RTSP",type:"span",clipboard:true,readonly:true,classes:["RTSP"]});break;case "TS":case "TS.exe":d.charAt(0)=="/"||d.slice(0,7)=="ts-exec"?g=[]:g.push({label:"TS",type:"span",clipboard:true,readonly:true,classes:["TS"]});break;case "TSSRT":case "TSSRT.exe":g.push({label:"SRT",type:"span",clipboard:true,readonly:true,classes:["TSSRT"]})}K.html(UI.buildUI(g));UI.updateLiveStreamHint(c.find("[name=name]").val(),
|
||||
c.find("[name=source]").val(),K)}a(d)}}}},e,J,{label:"Stop sessions",type:"checkbox",help:"When saving these stream settings, kill this stream's current connections.",pointer:{main:r,index:"stop_sessions"}},K,$("<br>"),{type:"custom",custom:Q},j,{type:"buttons",buttons:[{type:"cancel",label:"Cancel","function":function(){UI.navto("Streams")}},{type:"save",label:"Save","function":function(){ja("Streams")}},{type:"save",label:"Save and Preview","function":function(){ja("Preview")},classes:["saveandpreview"]}]}]));
|
||||
c.find("[name=name]").keyup(function(){UI.updateLiveStreamHint($(this).val(),c.find("[name=source]").val(),K)});UI.updateLiveStreamHint(c.find("[name=name]").val(),c.find("[name=source]").val(),K);c.find('[name="source"]').attr("list","source_datalist");break;case "Status":if(""==b){UI.navto("Streams");return}-1==b.indexOf("+")&&$("<button>").text("Settings").addClass("settings").click(function(){UI.navto("Edit",b)});var y=$("<div>").addClass("dashboard");c.html(UI.modules.stream.bigbuttons(b,a)).append($("<h2>").text('Status of "'+
|
||||
b+'"')).append(y);p=UI.modules.stream.findMist(function(){y.append(UI.modules.stream.status(b));y.append(UI.modules.stream.metadata(b));y.append($("<section>").addClass("logcont").append(UI.modules.stream.logs(b)).append(UI.modules.stream.accesslogs(b)));y.append(UI.modules.stream.processes(b));y.append(UI.modules.stream.triggers(b,"Status"));y.append(UI.modules.stream.pushes(b))});y.append(p);y.append(UI.modules.stream.actions("Status",b));break;case "Preview":if(""==b){UI.navto("Streams");return}var y=
|
||||
$("<div>").addClass("dashboard"),ma=$("<div>");c.html(UI.modules.stream.bigbuttons(b,a)).append($("<h2>").text('Preview of "'+b+'"')).append(ma).append(y);p=UI.modules.stream.findMist(function(){if(typeof mistplayers=="undefined")throw"Player.js was not applied properly.";ma.replaceWith(UI.modules.stream.status(b,{tags:false,thumbnail:false}));window.mv={};$preview=UI.modules.stream.preview(b,window.mv);y.append($preview);y.append(UI.modules.stream.playercontrols(window.mv,$preview)).append(UI.modules.stream.logs(b)).append(UI.modules.stream.metadata(b))});
|
||||
y.append(p);break;case "Embed":if(""==b){UI.navto("Streams");return}c.html(UI.modules.stream.bigbuttons(b,a)).append($("<h2>").text('Embed "'+b+'"'));$("<span>");c.append(UI.modules.stream.findMist(function(a){c.append(UI.modules.stream.embedurls(b,a,this.getUrls()))},!1,!0));break;case "Push":var F=$("<div>").text("Loading..");c.append(F);mist.send(function(a){function b(a){setTimeout(function(){mist.send(function(c){var d=false;if("push_list"in c&&c.push_list&&c.push_list.length){var d=true,g;for(g in c.push_list)if(a.indexOf(c.push_list[g][0])>
|
||||
c.find("[name=name]").keyup(function(){UI.updateLiveStreamHint($(this).val(),c.find("[name=source]").val(),K)});UI.updateLiveStreamHint(c.find("[name=name]").val(),c.find("[name=source]").val(),K);c.find('[name="source"]').attr("list","source_datalist");break;case "Status":if(""==b){UI.navto("Streams");return}-1==b.indexOf("+")&&$("<button>").text("Settings").addClass("settings").click(function(){UI.navto("Edit",b)});var x=$("<div>").addClass("dashboard");c.html(UI.modules.stream.bigbuttons(b,a)).append($("<h2>").text('Status of "'+
|
||||
b+'"')).append(x);p=UI.modules.stream.findMist(function(){x.append(UI.modules.stream.status(b));x.append(UI.modules.stream.metadata(b));x.append($("<section>").addClass("logcont").append(UI.modules.stream.logs(b)).append(UI.modules.stream.accesslogs(b)));x.append(UI.modules.stream.processes(b));x.append(UI.modules.stream.triggers(b,"Status"));x.append(UI.modules.stream.pushes(b))});x.append(p);x.append(UI.modules.stream.actions("Status",b));break;case "Preview":if(""==b){UI.navto("Streams");return}var x=
|
||||
$("<div>").addClass("dashboard"),ma=$("<div>");c.html(UI.modules.stream.bigbuttons(b,a)).append($("<h2>").text('Preview of "'+b+'"')).append(ma).append(x);p=UI.modules.stream.findMist(function(){if(typeof mistplayers=="undefined")throw"Player.js was not applied properly.";ma.replaceWith(UI.modules.stream.status(b,{tags:false,thumbnail:false}));window.mv={};$preview=UI.modules.stream.preview(b,window.mv);x.append($preview);x.append(UI.modules.stream.playercontrols(window.mv,$preview)).append(UI.modules.stream.logs(b)).append(UI.modules.stream.metadata(b))});
|
||||
x.append(p);break;case "Embed":if(""==b){UI.navto("Streams");return}c.html(UI.modules.stream.bigbuttons(b,a)).append($("<h2>").text('Embed "'+b+'"'));$("<span>");c.append(UI.modules.stream.findMist(function(a){c.append(UI.modules.stream.embedurls(b,a,this.getUrls()))},!1,!0));break;case "Push":var G=$("<div>").text("Loading..");c.append(G);mist.send(function(a){function b(a){setTimeout(function(){mist.send(function(c){var d=false;if("push_list"in c&&c.push_list&&c.push_list.length){var d=true,g;for(g in c.push_list)if(a.indexOf(c.push_list[g][0])>
|
||||
-1){d=false;break}}else d=true;if(d)for(g in a)h.find("tr[data-pushid="+a[g]+"]").remove();else b()},{push_list:1})},1E3)}function c(g,e){var f=$("<span>"),m=$("<span>");if(e=="Automatic"&&g.length>=4){var q=function(a,b,c){a=""+("$"+a+" ");switch(Number(b)){case 0:a=a+"is true";break;case 1:a=a+"is false";break;case 2:a=a+("== "+c);break;case 3:a=a+("!= "+c);break;case 10:a=a+("> (numerical) "+c);break;case 11:a=a+(">= (numerical) "+c);break;case 12:a=a+("< (numerical) "+c);break;case 13:a=a+("<= (numerical) "+
|
||||
c);break;case 20:a=a+("> (lexical) "+c);break;case 21:a=a+(">= (lexical) "+c);break;case 22:a=a+("< (lexical) "+c);break;case 23:a=a+("<= (lexical) "+c);break;default:a=a+"comparison operator unknown"}return a};f.append($("<span>").text(g[2]));g[3]&&f.append($("<span>").text(", schedule on "+(new Date(g[3]*1E3)).toLocaleString()));g.length>=5&&g[4]&&f.append($("<span>").text(", complete on "+(new Date(g[4]*1E3)).toLocaleString()));g.length>=8&&g[5]&&f.append($("<span>").text(", starts if "+q(g[5],
|
||||
g[6],g[7])));g.length>=11&&g[8]&&f.append($("<span>").text(", stops if "+q(g[8],g[9],g[10])))}else g.length>=4&&g[2]!=g[3]?f.append($("<span>").text(g[2])).append($("<span>").html("»").addClass("unit").css("margin","0 0.5em")).append($("<span>").text(g[3])):f.append($("<span>").text(g[2]));q=$("<td>").append($("<button>").text(e=="Automatic"?"Remove":"Stop").click(function(){if(confirm("Are you sure you want to "+$(this).text().toLowerCase()+" this push?\n"+g[1]+" to "+g[2])){var a=$(this).closest("tr");
|
||||
a.html($("<td colspan=99>").html($("<span>").addClass("red").text(e=="Automatic"?"Removing..":"Stopping..")));if(e=="Automatic"){var c=g.slice(1);mist.send(function(){a.remove()},{push_auto_remove:[c]})}else mist.send(function(){b([g[0]])},{push_stop:[g[0]]})}}));if(e=="Automatic"){q.prepend($("<button>").text("Edit").click(function(){UI.navto("Start Push","auto_"+($(this).closest("tr").index()-1))}));q.append($("<button>").text("Stop pushes").click(function(){if(confirm('Are you sure you want to stop all pushes matching \n"'+
|
||||
g[1]+" to "+g[2]+'"?'+(d.wait!=0?"\n\nRetrying is enabled. That means the push will just restart. You'll probably want to set that to 0.":""))){var c=$(this);c.text("Stopping pushes..");var e=[],f;for(f in a.push_list)if(g[1]==a.push_list[f][1]&&g[2]==a.push_list[f][2]){e.push(a.push_list[f][0]);h.find("tr[data-pushid="+a.push_list[f][0]+"]").html($("<td colspan=99>").html($("<span>").addClass("red").text("Stopping..")))}mist.send(function(){c.text("Stop pushes");b(e)},{push_stop:e})}}))}else{if(g.length>=
|
||||
6){var j=g[5];m.append($("<div>").append("Active for: "+UI.format.duration(j.active_seconds))).append($("<div>").append("Data transferred: "+UI.format.bytes(j.bytes))).append($("<div>").append("Media time transferred: "+UI.format.duration(j.mediatime*0.001)));"pkt_retrans_count"in j&&m.append($("<div>").append("Packets retransmitted: "+UI.format.number(j.pkt_retrans_count||0)));"pkt_loss_count"in j&&m.append($("<div>").append("Packets lost: "+UI.format.number(j.pkt_loss_count||0)+" ("+UI.format.addUnit(UI.format.number(j.pkt_loss_perc||
|
||||
0),"%")+" over the last "+UI.format.addUnit(5,"s")+")"))}if(g.length>=5)for(var k in g[4]){j=g[4][k];m.append($("<div>").append(UI.format.time(j[0])+" ["+j[1]+"] "+j[2]))}}return $("<tr>").css("vertical-align","top").attr("data-pushid",g[0]).append($("<td>").text(g[1])).append($("<td>").append(f.children())).append($("<td>").addClass("logs").append(m.children())).append(q)}F.html(UI.buildUI([{type:"help",help:"You can push streams to files or other servers, allowing them to broadcast your stream as well."}]));
|
||||
var d=a.push_settings;d||(d={});var h=$("<table>").append($("<tr>").append($("<th>").text("Stream")).append($("<th>").text("Target")).append($("<th>")).append($("<th>"))),g=h.clone();if("push_list"in a)for(var e in a.push_list)h.append(c(a.push_list[e],"Manual"));if("push_auto_list"in a)for(e in a.push_auto_list){var f=a.push_auto_list[e].slice();f.unshift(-1);g.append(c(f,"Automatic"))}F.append($("<h3>").text("Automatic push settings")).append(UI.buildUI([{label:"Delay before retry",unit:"s",type:"int",
|
||||
0),"%")+" over the last "+UI.format.addUnit(5,"s")+")"))}if(g.length>=5)for(var k in g[4]){j=g[4][k];m.append($("<div>").append(UI.format.time(j[0])+" ["+j[1]+"] "+j[2]))}}return $("<tr>").css("vertical-align","top").attr("data-pushid",g[0]).append($("<td>").text(g[1])).append($("<td>").append(f.children())).append($("<td>").addClass("logs").append(m.children())).append(q)}G.html(UI.buildUI([{type:"help",help:"You can push streams to files or other servers, allowing them to broadcast your stream as well."}]));
|
||||
var d=a.push_settings;d||(d={});var h=$("<table>").append($("<tr>").append($("<th>").text("Stream")).append($("<th>").text("Target")).append($("<th>")).append($("<th>"))),g=h.clone();if("push_list"in a)for(var e in a.push_list)h.append(c(a.push_list[e],"Manual"));if("push_auto_list"in a)for(e in a.push_auto_list){var f=a.push_auto_list[e].slice();f.unshift(-1);g.append(c(f,"Automatic"))}G.append($("<h3>").text("Automatic push settings")).append(UI.buildUI([{label:"Delay before retry",unit:"s",type:"int",
|
||||
min:0,help:"How long the delay should be before MistServer retries an automatic push.<br>If set to 0, it does not retry.","default":3,pointer:{main:d,index:"wait"}},{label:"Maximum retries",unit:"/s",type:"int",min:0,help:"The maximum amount of retries per second (for all automatic pushes).<br>If set to 0, there is no limit.","default":0,pointer:{main:d,index:"maxspeed"}},{type:"buttons",buttons:[{type:"save",label:"Save","function":function(){mist.send(function(){UI.navto("Push")},{push_settings:d})}}]}])).append($("<h3>").text("Automatic push settings")).append($("<button>").text("Add an automatic push").click(function(){UI.navto("Start Push",
|
||||
"auto")}));g.find("tr").length==1?F.append($("<div>").text("No automatic pushes have been configured.").addClass("text").css("margin-top","0.5em")):F.append(g);F.append($("<h3>").text("Pushes")).append($("<button>").text("Start a push").click(function(){UI.navto("Start Push")}));if(h.find("tr").length==1)F.append($("<div>").text("No pushes are active.").addClass("text").css("margin-top","0.5em"));else{var g=[],f=[],m=$("<select>").css("margin-left","0.5em").append($("<option>").text("Any stream").val("")),
|
||||
q=$("<select>").css("margin-left","0.5em").append($("<option>").text("Any target").val(""));for(e in a.push_list){g.indexOf(a.push_list[e][1])==-1&&g.push(a.push_list[e][1]);f.indexOf(a.push_list[e][2])==-1&&f.push(a.push_list[e][2])}g.sort();f.sort();for(e in g)m.append($("<option>").text(g[e]));for(e in f)q.append($("<option>").text(f[e]));F.append($("<button>").text("Stop all pushes").click(function(){var c=[],d;for(d in a.push_list)c.push(a.push_list[d][0]);if(c.length!=0&&confirm("Are you sure you want to stop all pushes?")){mist.send(function(){b(c)},
|
||||
"auto")}));g.find("tr").length==1?G.append($("<div>").text("No automatic pushes have been configured.").addClass("text").css("margin-top","0.5em")):G.append(g);G.append($("<h3>").text("Pushes")).append($("<button>").text("Start a push").click(function(){UI.navto("Start Push")}));if(h.find("tr").length==1)G.append($("<div>").text("No pushes are active.").addClass("text").css("margin-top","0.5em"));else{var g=[],f=[],m=$("<select>").css("margin-left","0.5em").append($("<option>").text("Any stream").val("")),
|
||||
q=$("<select>").css("margin-left","0.5em").append($("<option>").text("Any target").val(""));for(e in a.push_list){g.indexOf(a.push_list[e][1])==-1&&g.push(a.push_list[e][1]);f.indexOf(a.push_list[e][2])==-1&&f.push(a.push_list[e][2])}g.sort();f.sort();for(e in g)m.append($("<option>").text(g[e]));for(e in f)q.append($("<option>").text(f[e]));G.append($("<button>").text("Stop all pushes").click(function(){var c=[],d;for(d in a.push_list)c.push(a.push_list[d][0]);if(c.length!=0&&confirm("Are you sure you want to stop all pushes?")){mist.send(function(){b(c)},
|
||||
{push_stop:c});h.find("tr:not(:first-child)").html($("<td colspan=99>").append($("<span>").addClass("red").text("Stopping..")));$(this).remove()}})).append($("<label>").css("margin-left","1em").append($("<span>").text("Stop all pushes that match: ").css("font-size","0.9em")).append(m).append($("<span>").css("margin-left","0.5em").text("and").css("font-size","0.9em")).append(q).append($("<button>").css("margin-left","0.5em").text("Apply").click(function(){var c=m.val(),d=q.val();if(c==""&&d=="")return alert("Looks like you want to stop all pushes. Maybe you should use that button?");
|
||||
var g={},e;for(e in a.push_list)if((c==""||a.push_list[e][1]==c)&&(d==""||a.push_list[e][2]==d))g[a.push_list[e][0]]=a.push_list[e];if(Object.keys(g).length==0)return alert("No matching pushes.");c="Are you sure you want to stop these pushes?\n\n";for(e in g)c=c+(g[e][1]+" to "+g[e][2]+"\n");if(confirm(c)){g=Object.keys(g);mist.send(function(){b(g)},{push_stop:g});for(e in g)h.find("tr[data-pushid="+g[e]+"]").html($("<td colspan=99>").html($("<span>").addClass("red").text("Stopping..")))}}))).append(h)}UI.interval.set(function(){mist.send(function(a){var b=
|
||||
h.find("tr").first();h.empty();h.append(b);for(var d in a.push_list)h.append(c(a.push_list[d]))},{push_list:1})},5E3)},{push_settings:1,push_list:1,push_auto_list:1});break;case "Start Push":if(!("capabilities"in mist.data)||!("variable_list"in mist.data)||!("external_writer_list"in mist.data)){c.append("Loading MistServer capabilities..");mist.send(function(){UI.showTab("Start Push",b,d)},{capabilities:!0,variable_list:!0,external_writer_list:!0});return}var w,R=function(g){var h=false,e=b.split("_");
|
||||
b=e[0];e.length==2&&(h=e[1]);if(h!==false&&typeof g=="undefined")mist.send(function(a){R(a.push_auto_list[h])},{push_auto_list:1});else{var f=[],m=[],q={},j=[],k;for(k in mist.data.capabilities.connectors){e=mist.data.capabilities.connectors[k];if("push_urls"in e){q[k]=e.push_urls;for(var l in e.push_urls)e.push_urls[l][0]=="/"?f.push(e.push_urls[l]):m.push(e.push_urls[l])}}if(mist.data.external_writer_list)for(k in mist.data.external_writer_list){e=mist.data.external_writer_list[k];if(e.length>=
|
||||
3)for(l in e[2])j.push(e[2][l]+"://")}f.sort();m.sort();b=="auto"&&c.find("h2").text("Add automatic push");var i={params:{}},n=[];if(b=="auto"&&typeof g!="undefined"){i={stream:g[0],target:g[1],params:{}};l=i.target.split("?");if(l.length>1){n=l.pop();i.target=l.join("?");n=n.split("&");for(k in n){l=n[k].split("=");i.params[l.shift()]=l.join("=")}}if(g.length>=3)i.scheduletime=g[2]!=0?g[2]:null;if(g.length>=4)i.completetime=g[3]!=0?g[3]:null;if(g.length>=5)i.startVariableName=g[4]!=""?g[4]:null;
|
||||
if(g.length>=6)i.startVariableOperator=g[5]!=""?g[5]:null;if(g.length>=7)i.startVariableValue=g[6]!=""?g[6]:null;if(g.length>=8)i.endVariableName=g[7]!=""?g[7]:null;if(g.length>=9)i.endVariableOperator=g[8]!=""?g[8]:null;if(g.length>=10)i.endVariableValue=g[9]!=""?g[9]:null}var o=$("<div>").css("margin","1em 0"),p=$("<div>"),r,x;if(b=="auto"){p.css("margin","1em 0").html(UI.buildUI([{label:"This push should be active",help:"When 'based on server time' is selected, a start and/or end timestamp can be configured. When it's 'based on a variable', the push will be activated while the specified variable matches the specified value.",
|
||||
if(g.length>=6)i.startVariableOperator=g[5]!=""?g[5]:null;if(g.length>=7)i.startVariableValue=g[6]!=""?g[6]:null;if(g.length>=8)i.endVariableName=g[7]!=""?g[7]:null;if(g.length>=9)i.endVariableOperator=g[8]!=""?g[8]:null;if(g.length>=10)i.endVariableValue=g[9]!=""?g[9]:null}var o=$("<div>").css("margin","1em 0"),p=$("<div>"),r,A;if(b=="auto"){p.css("margin","1em 0").html(UI.buildUI([$("<h3>").text("Automatic push options"),{label:"This push should be active",help:"When 'based on server time' is selected, a start and/or end timestamp can be configured. When it's 'based on a variable', the push will be activated while the specified variable matches the specified value.",
|
||||
type:"select",select:[["time","Based on server time"],["variable","Based on a variable"]],value:i.startVariableName||i.endVariableName?"variable":"time",classes:["activewhen"],"function":function(){var a=p.find(".varbased").closest(".UIelement"),b=p.find(".timebased").closest(".UIelement");if($(this).getval()=="time"){a.hide();b.css("display","")}else{b.hide();a.css("display","");p.find('[name="startVariableOperator"]').trigger("change");p.find('[name="endVariableOperator"]').trigger("change")}}},
|
||||
$("<br>"),$("<span>").addClass("UIelement").append($("<h3>").text("Start the push").addClass("varbased")),{classes:["varbased"],label:"Use this variable",type:"str",help:"This variable should be used to determine if this push should be started.",prefix:"$",datalist:Object.keys(mist.data.variable_list||[]),pointer:{main:i,index:"startVariableName"}},{classes:["varbased"],label:"Comparison operator",type:"select",select:[[0,"is true"],[1,"is false"],[2,"=="],[3,"!="],[10,"> (numerical)"],[11,">= (numerical)"],
|
||||
[12,"< (numerical)"],[13,"<= (numerical)"],[20,"> (lexical)"],[21,">= (lexical)"],[22,"< (lexical)"],[23,"<= (lexical)"]],value:2,css:{display:"none"},help:"How would you like to compare this variable?",pointer:{main:i,index:"startVariableOperator"},"function":function(){var a=p.find('[name="startVariableValue"]').closest(".UIelement");Number($(this).getval())<2?a.hide():a.css("display","")}},{classes:["varbased"],label:"Variable value",type:"str",help:"The variable will be compared with this value to determine if this push should be started.<br>You can also enter another variable here!",
|
||||
|
@ -201,39 +201,38 @@ help:"This may either be a full stream name, a partial wildcard stream name, or
|
|||
validate:["required",function(a){a=a.split("+");a=a[0];return a in mist.data.streams?false:{msg:"'"+a+"' is not a stream name.",classes:["orange"],"break":false}}],datalist:w,value:d[1]!=""?d[1]:""},{label:"Target",type:"str",help:"Where the stream will be pushed to.<br> Valid push formats: <ul> <li>"+m.join("</li><li>")+"</li> </ul> Valid file formats: <ul> <li>"+f.join("</li><li>")+"</li> </ul> "+
|
||||
(j.length?"Additionally, the following protocols (from generic writers) may be used in combination with any of the above file formats:<ul><li>"+j.join("</li><li>")+"</li></ul>":"")+" Valid text replacements: <ul> <li>$stream - inserts the stream name used to push to MistServer</li> <li>$day - inserts the current day number</li><li>$month - inserts the current month number</li> <li>$year - inserts the current year number</li><li>$hour - inserts the hour timestamp when stream was received</li> <li>$minute - inserts the minute timestamp the stream was received</li> <li>$seconds - inserts the seconds timestamp when the stream was received</li> <li>$datetime - inserts $year.$month.$day.$hour.$minute.$seconds timestamp when the stream was received</li> </ul>",
|
||||
pointer:{main:i,index:"target"},validate:["required",function(a){for(var b in m)if(mist.inputMatch(m[b],a))return false;for(b in f){if(mist.inputMatch(f[b],a))return false;for(var c in j)if(mist.inputMatch(j[c]+f[b].slice(1),a))return false}return{msg:"Does not match a valid target.<br>Valid push formats: <ul> <li>"+m.join("</li><li>")+"</li> </ul> Valid file formats: <ul> <li>"+f.join("</li><li>")+
|
||||
"</li> </ul> "+(j.length?"Additionally, the following protocols may be used in combination with any of the above file formats:<ul><li>"+j.join("</li><li>")+"</li></ul>":""),classes:["red"]}}],"function":function(){function a(b,d){if(b.prot_only&&String().match&&c.match(/.+\:\/\/.+/)===null)delete r[d];else if(b.file_only&&c[0]!="/")delete r[d];else if(b.type=="group")for(var g in b.options)a(b.options[g],g);else x[d]=b}var b=false,c=$(this).getval();for(connector in q)for(var d in q[connector]){if(mist.inputMatch(q[connector][d],
|
||||
c)){b=connector;break}if(q[connector][d][0]=="/")for(var g in j)if(mist.inputMatch(j[g]+q[connector][d].slice(1),c)){b=connector;break}}if(b){if(!("friendly"in mist.data.capabilities.connectors[b]))mist.data.capabilities.connectors[b].friendly=mist.data.capabilities.connectors[b].name;o.html($("<h3>").text(mist.data.capabilities.connectors[b].friendly.replace("over HTTP","")));r=$.extend({},mist.data.capabilities.connectors[b].push_parameters);x={};for(d in mist.data.capabilities.connectors[b].push_parameters)a(mist.data.capabilities.connectors[b].push_parameters[d],
|
||||
d);b={desc:mist.data.capabilities.connectors[b].desc.replace("over HTTP",""),optional:r,sort:"sort"};b=mist.convertBuildOptions(b,i.params);g=[];for(d in n){var h=n[d].split("="),e=h[0];e in r||g.push(e+(h.length>1?"="+h.slice(1).join("="):""))}b.push($("<br>"));b.push({type:"inputlist",label:"Custom url parameters",value:g,classes:["custom_url_parameters"],input:{type:"str",placeholder:"name=value",prefix:""},help:"Any custom url parameters not covered by the parameters configurable above.",pointer:{main:i,
|
||||
index:"custom_url_params"}});o.append(UI.buildUI(b))}else o.html($("<h4>").addClass("red").text("Unrecognized target.")).append($("<span>").text("Please edit the push target."))}},p,o];k.push({type:"buttons",buttons:[{type:"cancel",label:"Cancel","function":function(){d[0]&&d[0]!=a?UI.navto(d[0],d[1]):UI.navto("Push")}},{type:"save",label:"Save",preSave:function(){delete i.startVariableName;delete i.startVariableOperator;delete i.startVariableValue;delete i.endVariableName;delete i.endVariableOperator;
|
||||
delete i.endVariableValue;delete i.completetime;delete i.scheduletime},"function":function(){var c=i.params,h;for(h in c)c[h]===null?delete c[h]:h in x||delete c[h];if(i.startVariableName||i.endVariableName){i.scheduletime=0;i.completetime=0}if(i.startVariableName===null){delete i.startVariableName;delete i.startVariableOperator;delete i.startVariableValue}if(i.endVariableName===null){delete i.endVariableName;delete i.endVariableOperator;delete i.endVariableValue}if(i.scheduletime)c.recstartunix=
|
||||
i.scheduletime;if(Object.keys(c).length||i.custom_url_params&&i.custom_url_params.length){var e="?",f=i.target.split("?");if(f.length>1){e="&";f=f[f.length-1];f=f.split("&");for(h in f){var m=f[h].split("=")[0];m in c&&delete c[m]}}if(Object.keys(c).length||i.custom_url_params&&i.custom_url_params.length){f=[];for(h in c)f.push(h+"="+c[h]);for(h in i.custom_url_params)f.push(i.custom_url_params[h]);e=e+f.join("&");i.target=i.target+e}}delete i.params;delete i.custom_url_params;c={};c[b=="auto"?"push_auto_add":
|
||||
"push_start"]=i;if(typeof g!="undefined"&&(g[0]!=i.stream||g[1]!=i.target))c.push_auto_remove=[g];mist.send(function(){d[0]&&d[0]!=a?UI.navto(d[0],d[1]):UI.navto("Push")},c)}}]});c.append(UI.buildUI(k))}};mist.data.LTS?mist.send(function(a){(w=a.active_streams)||(w=[]);var a=[],b;for(b in w)w[b].indexOf("+")!=-1&&a.push(w[b].replace(/\+.*/,"")+"+");w=w.concat(a);var c=0,d=0;for(b in mist.data.streams){w.push(b);if(mist.inputMatch(UI.findInput("Folder").source_match,mist.data.streams[b].source)){w.push(b+
|
||||
"+");mist.send(function(a,b){var g=b.stream,h;for(h in a.browse.files)for(var e in mist.data.capabilities.inputs)e.indexOf("Buffer")>=0||(e.indexOf("Folder")>=0||e.indexOf("Buffer.exe")>=0||e.indexOf("Folder.exe")>=0)||mist.inputMatch(mist.data.capabilities.inputs[e].source_match,"/"+a.browse.files[h])&&w.push(g+"+"+a.browse.files[h]);d++;if(c==d){w=w.filter(function(a,b,c){return c.lastIndexOf(a)===b}).sort();R()}},{browse:mist.data.streams[b].source},{stream:b});c++}}if(c==d){w=w.filter(function(a,
|
||||
b,c){return c.lastIndexOf(a)===b}).sort();R()}},{active_streams:1}):(w=Object.keys(mist.data.streams),R());break;case "Triggers":if(!("triggers"in mist.data.config)||!mist.data.config.triggers)mist.data.config.triggers={};A=$("<tbody>");h=$("<table>").html($("<thead>").html($("<tr>").html($("<th>").text("Trigger on").attr("data-sort-type","string").addClass("sorting-asc")).append($("<th>").text("Applies to").attr("data-sort-type","string")).append($("<th>").text("Handler").attr("data-sort-type","string")).append($("<th>")))).append(A);
|
||||
c.append(UI.buildUI([{type:"help",help:"Triggers are a way to react to events that occur inside MistServer. These allow you to block specific users, redirect streams, keep tabs on what is being pushed where, etcetera. For full documentation, please refer to the developer documentation section on the MistServer website."}])).append($("<button>").text("New trigger").click(function(){UI.navto("Edit Trigger")})).append(h);h.stupidtable();h=mist.data.config.triggers;for(p in h)for(j in h[p])e=triggerRewrite(h[p][j]),
|
||||
A.append($("<tr>").attr("data-index",p+","+j).append($("<td>").text(p)).append($("<td>").text("streams"in e?e.streams.join(", "):"")).append($("<td>").text(e.handler)).append($("<td>").html($("<button>").text("Edit").click(function(){UI.navto("Edit Trigger",$(this).closest("tr").attr("data-index"))})).append($("<button>").text("Delete").click(function(){var a=$(this).closest("tr").attr("data-index").split(",");if(confirm("Are you sure you want to delete this "+a[0]+" trigger?")){mist.data.config.triggers[a[0]].splice(a[1],
|
||||
1);mist.data.config.triggers[a[0]].length==0&&delete mist.data.config.triggers[a[0]];mist.send(function(){UI.navto("Triggers")},{config:mist.data.config})}}))));break;case "Edit Trigger":if(!("triggers"in mist.data.config)||!mist.data.config.triggers)mist.data.config.triggers={};if("undefined"==typeof mist.data.capabilities){mist.send(function(){UI.showTab(a,b,d)},{capabilities:!0});c.append("Loading..");return}b?(b=b.split(","),j=triggerRewrite(mist.data.config.triggers[b[0]][b[1]]),r={triggeron:b[0],
|
||||
appliesto:j.streams,url:j.handler,async:j.sync,"default":j["default"],params:j.params}):(c.html($("<h2>").text("New Trigger")),r={});j=[];for(p in mist.data.capabilities.triggers)j.push([p,p+": "+mist.data.capabilities.triggers[p].when]);var Y=$("<div>").addClass("desc"),na=$("<div>");c.append(UI.buildUI([{label:"Trigger on",pointer:{main:r,index:"triggeron"},help:"For what event this trigger should activate.",type:"select",select:j,validate:["required"],"function":function(){var a=$(this).getval(),
|
||||
b=mist.data.capabilities.triggers[a];Y.html("");if(b){a=[$("<h4>").text("Trigger properties"),{type:"help",help:'The trigger "<i>'+a+'</i>" has the following properties:'},{type:"span",label:"Triggers",value:b.when,help:"When this trigger is activated"}];b.payload!=""&&a.push({label:"Payload",type:"textarea",value:b.payload,rows:b.payload.split("\n").length,readonly:true,clipboard:true,help:"The information this trigger sends to the handler."});a.push({type:"span",label:"Requires response",value:function(a){switch(a){case "ignored":return"No. The trigger will ignore the response of the handler.";
|
||||
case "always":return"Yes. The trigger needs a response to proceed.";case "when-blocking":return"The trigger needs a response to proceed if it is configured to be blocking.";default:return a}}(b.response),help:"Whether this trigger requires a response from the trigger handler"});a.push({type:"span",label:"Response action",value:b.response_action,help:"What this trigger will do with its handler's response"});Y.append(UI.buildUI(a));b.stream_specific?$("[name=appliesto]").closest(".UIelement").show():
|
||||
$("[name=appliesto]").setval([]).closest(".UIelement").hide();if(b.argument){$("[name=params]").closest(".UIelement").show();na.text(b.argument)}else $("[name=params]").setval("").closest(".UIelement").hide()}}},Y,$("<h4>").text("Trigger settings"),{label:"Applies to",pointer:{main:r,index:"appliesto"},help:"For triggers that can apply to specific streams, this value decides what streams they are triggered for. (none checked = always triggered)",type:"checklist",checklist:Object.keys(mist.data.streams),
|
||||
value:""!=d[1]?[d[1]]:[]},$("<br>"),{label:"Handler (URL or executable)",help:"This can be either an HTTP URL or a full path to an executable.",pointer:{main:r,index:"url"},validate:["required"],type:"str"},{label:"Blocking",type:"checkbox",help:"If checked, pauses processing and uses the response of the handler. If the response does not start with 1, true, yes or cont, further processing is aborted. If unchecked, processing is never paused and the response is not checked.",pointer:{main:r,index:"async"}},
|
||||
{label:"Parameters",type:"str",help:$("<div>").text("The extra data you want this trigger to use.").append(na),pointer:{main:r,index:"params"}},{label:"Default response",type:"str",help:"The default response in case the handler fails or is set to non-blocking.",placeholder:"true",pointer:{main:r,index:"default"}},{type:"buttons",buttons:[{type:"cancel",label:"Cancel","function":function(){d[0]&&d[0]!=a?UI.navto(d[0],d[1]):UI.navto("Triggers")}},{type:"save",label:"Save","function":function(){b&&mist.data.config.triggers[b[0]].splice(b[1],
|
||||
1);var c={handler:r.url,sync:r.async?true:false,streams:typeof r.appliesto=="undefined"?[]:r.appliesto,params:r.params,"default":r["default"]};if(!("triggers"in mist.data.config))mist.data.config.triggers={};r.triggeron in mist.data.config.triggers||(mist.data.config.triggers[r.triggeron]=[]);mist.data.config.triggers[r.triggeron].push(c);mist.send(function(){d[0]&&d[0]!=a?UI.navto(d[0],d[1]):UI.navto("Triggers")},{config:mist.data.config})}}]}]));$("[name=triggeron]").trigger("change");break;case "Logs":var oa=
|
||||
$("<button>").text("Refresh now").click(function(){$(this).text("Loading..");mist.send(function(){Z();oa.text("Refresh now")})}).css("padding","0.2em 0.5em").css("flex-grow",0);c.append(UI.buildUI([{type:"help",help:"Here you have an overview of all edited settings within MistServer and possible warnings or errors MistServer has encountered. MistServer stores up to 100 logs at a time."},{label:"Refresh every",type:"select",select:[[10,"10 seconds"],[30,"30 seconds"],[60,"minute"],[300,"5 minutes"]],
|
||||
value:30,"function":function(){UI.interval.clear();UI.interval.set(function(){mist.send(function(){Z()})},$(this).val()*1E3)},help:"How often the table below should be updated."},{label:"..or",type:"DOMfield",DOMfield:oa,help:"Instantly refresh the table below."}]));c.append($("<button>").text("Purge logs").click(function(){mist.send(function(){mist.data.log=[];UI.navto("Logs")},{clearstatlogs:true})}));A=$("<tbody>").css("font-size","0.9em");c.append($("<table>").addClass("logs").append(A));var qa=
|
||||
function(a){var b=$("<span>").text(a);switch(a){case "WARN":b.addClass("orange");break;case "ERROR":case "FAIL":b.addClass("red")}return b},Z=function(){var a=mist.data.log;if(a){a.length>=2&&a[0][0]<a[a.length-1][0]&&a.reverse();A.html("");for(var b in a){var c=$("<span>").addClass("content"),d=a[b][2].split("|"),g;for(g in d)c.append($("<span>").text(d[g]));A.append($("<tr>").html($("<td>").text(UI.format.dateTime(a[b][0],"long")).css("white-space","nowrap")).append($("<td>").html(qa(a[b][1])).css("text-align",
|
||||
"center")).append($("<td>").html(c).css("text-align","left")))}}};Z();break;case "Statistics":var E=$("<span>").text("Loading..");c.append(E);var r={graph:"new"},z=mist.stored.get().graphs?$.extend(!0,{},mist.stored.get().graphs):{},O={};for(p in mist.data.streams)O[p]=!0;for(p in mist.data.active_streams)O[mist.data.active_streams[p]]=!0;var O=Object.keys(O).sort(),aa=[];for(p in mist.data.config.protocols)aa.push(mist.data.config.protocols[p].connector);aa.sort();mist.send(function(){UI.plot.datatype.templates.cpuload.cores=
|
||||
0;for(var a in mist.data.capabilities.cpu)UI.plot.datatype.templates.cpuload.cores=UI.plot.datatype.templates.cpuload.cores+mist.data.capabilities.cpu[a].cores;E.html(UI.buildUI([{type:"help",help:"Here you will find the MistServer stream statistics, you can select various categories yourself. All statistics are live: up to five minutes are saved."},$("<h3>").text("Select the data to display"),{label:"Add to",type:"select",select:[["new","New graph"]],pointer:{main:r,index:"graph"},classes:["graph_ids"],
|
||||
"function":function(){if($(this).val()){var a=E.find(".graph_xaxis"),b=E.find(".graph_id");if($(this).val()=="new"){a.children("option").prop("disabled",false);b.setval("Graph "+(Object.keys(z).length+1)).closest("label").show()}else{var c=z[$(this).val()].xaxis;a.children("option").prop("disabled",true).filter('[value="'+c+'"]').prop("disabled",false);b.closest("label").hide()}a.children('option[value="'+a.val()+'"]:disabled').length&&a.val(a.children("option:enabled").first().val());a.trigger("change")}}},
|
||||
{label:"Graph id",type:"str",pointer:{main:r,index:"id"},classes:["graph_id"],validate:[function(a){return a in z?{msg:"This graph id has already been used. Please enter something else.",classes:["red"]}:false}]},{label:"Axis type",type:"select",select:[["time","Time line"]],pointer:{main:r,index:"xaxis"},value:"time",classes:["graph_xaxis"],"function":function(){$s=E.find(".graph_datatype");switch($(this).getval()){case "coords":$s.children("option").prop("disabled",true).filter('[value="coords"]').prop("disabled",
|
||||
false);break;case "time":$s.children("option").prop("disabled",false).filter('[value="coords"]').prop("disabled",true)}if(!$s.val()||$s.children('option[value="'+$s.val()+'"]:disabled').length){$s.val($s.children("option:enabled").first().val());$s.trigger("change")}}},{label:"Data type",type:"select",select:[["clients","Connections"],["upbps","Bandwidth (up)"],["downbps","Bandwidth (down)"],["cpuload","CPU use"],["memload","Memory load"],["coords","Client location"],["perc_lost","Lost packages"],
|
||||
["perc_retrans","Re-transmitted packages"]],pointer:{main:r,index:"datatype"},classes:["graph_datatype"],"function":function(){$s=E.find(".graph_origin");switch($(this).getval()){case "cpuload":case "memload":$s.find("input[type=radio]").not('[value="total"]').prop("disabled",true);$s.find('input[type=radio][value="total"]').prop("checked",true);break;default:$s.find("input[type=radio]").prop("disabled",false)}}},{label:"Data origin",type:"radioselect",radioselect:[["total","All"],["stream","The stream:",
|
||||
O],["protocol","The protocol:",aa]],pointer:{main:r,index:"origin"},value:["total"],classes:["graph_origin"]},{type:"buttons",buttons:[{label:"Add data set",type:"save","function":function(){var a;if(r.graph=="new"){a=UI.plot.addGraph(r,b);z[a.id]=a;E.find("input.graph_id").val("");E.find("select.graph_ids").append($("<option>").text(a.id)).val(a.id).trigger("change")}else a=z[r.graph];var c=UI.plot.datatype.getOptions({datatype:r.datatype,origin:r.origin});a.datasets.push(c);UI.plot.save(a);UI.plot.go(z)}}]}]));
|
||||
var b=$("<div>").addClass("graph_container");c.append(b);var d=E.find("select.graph_ids");for(a in z){var g=UI.plot.addGraph(z[a],b);d.append($("<option>").text(g.id)).val(g.id);var h=[],e;for(e in z[a].datasets){var f=UI.plot.datatype.getOptions({datatype:z[a].datasets[e].datatype,origin:z[a].datasets[e].origin});h.push(f)}g.datasets=h;z[g.id]=g}d.trigger("change");UI.plot.go(z);UI.interval.set(function(){UI.plot.go(z)},1E4)},{active_streams:!0,capabilities:!0});break;case "Server Stats":if("undefined"==
|
||||
typeof mist.data.capabilities){mist.send(function(){UI.showTab(a)},{capabilities:!0});c.append("Loading..");return}var ba=$("<table>"),I=$("<table>"),j={vheader:"CPUs",labels:["Model","Processor speed","Amount of cores","Amount of threads"],content:[]};for(p in mist.data.capabilities.cpu)h=mist.data.capabilities.cpu[p],j.content.push({header:"CPU #"+(Number(p)+1),body:[h.model,UI.format.addUnit(UI.format.number(h.mhz),"MHz"),h.cores,h.threads]});p=UI.buildVheaderTable(j);var pa=function(){var a=mist.data.capabilities.mem,
|
||||
b=mist.data.capabilities.load,a={vheader:"Memory",labels:["Used","Cached","Available","Total"],content:[{header:"Physical memory",body:[UI.format.bytes(a.used*1048576)+" ("+UI.format.addUnit(b.memory,"%")+")",UI.format.bytes(a.cached*1048576),UI.format.bytes(a.free*1048576),UI.format.bytes(a.total*1048576)]},{header:"Swap memory",body:[UI.format.bytes((a.swaptotal-a.swapfree)*1048576),UI.format.addUnit("","N/A"),UI.format.bytes(a.swapfree*1048576),UI.format.bytes(a.swaptotal*1048576)]}]},a=UI.buildVheaderTable(a);
|
||||
ba.replaceWith(a);ba=a;b={vheader:"Load average",labels:["CPU use","1 minute","5 minutes","15 minutes"],content:[{header:" ",body:[UI.format.addUnit(UI.format.number(mist.data.capabilities.cpu_use/10),"%"),UI.format.number(b.one/100),UI.format.number(b.five/100),UI.format.number(b.fifteen/100)]}]};b=UI.buildVheaderTable(b);I.replaceWith(b);I=b};pa();c.append(UI.buildUI([{type:"help",help:"You can find general server statistics here. Note that memory and CPU usage is for your entire machine, not just MistServer."}])).append($("<table>").css("width",
|
||||
"</li> </ul> "+(j.length?"Additionally, the following protocols may be used in combination with any of the above file formats:<ul><li>"+j.join("</li><li>")+"</li></ul>":""),classes:["red"]}}],"function":function(){function a(b,d){if(b.prot_only&&String().match&&c.match(/.+\:\/\/.+/)===null)delete r[d];else if(b.file_only&&c[0]!="/")delete r[d];else if(b.type=="group")for(var g in b.options)a(b.options[g],g);else A[d]=b}var b=false,c=$(this).getval();for(connector in q)for(var d in q[connector]){if(mist.inputMatch(q[connector][d],
|
||||
c)){b=connector;break}if(q[connector][d][0]=="/")for(var g in j)if(mist.inputMatch(j[g]+q[connector][d].slice(1),c)){b=connector;break}}if($(this).data("last_match")!=b){$(this).data("last_match",b);if(b){if(!("friendly"in mist.data.capabilities.connectors[b]))mist.data.capabilities.connectors[b].friendly=mist.data.capabilities.connectors[b].name;o.html($("<h3>").text(mist.data.capabilities.connectors[b].friendly.replace("over HTTP","")));r=$.extend({},mist.data.capabilities.connectors[b].push_parameters);
|
||||
A={};for(d in mist.data.capabilities.connectors[b].push_parameters)a(mist.data.capabilities.connectors[b].push_parameters[d],d);b={desc:mist.data.capabilities.connectors[b].desc.replace("over HTTP",""),optional:r,sort:"sort"};b=mist.convertBuildOptions(b,i.params);b[1].is("h4")&&b.splice(1,1);g=[];for(d in n){var h=n[d].split("="),e=h[0];e in A||g.push(e+(h.length>1?"="+h.slice(1).join("="):""))}b.push($("<br>"));b.push({type:"inputlist",label:"Custom url parameters",value:g,classes:["custom_url_parameters"],
|
||||
input:{type:"str",placeholder:"name=value",prefix:""},help:"Any custom url parameters not covered by the parameters configurable above.",pointer:{main:i,index:"custom_url_params"}});o.append(UI.buildUI(b))}else o.html($("<h4>").addClass("red").text("Unrecognized target.")).append($("<span>").text("Please edit the push target."))}}},o,p];k.push({type:"buttons",buttons:[{type:"cancel",label:"Cancel","function":function(){d[0]&&d[0]!=a?UI.navto(d[0],d[1]):UI.navto("Push")}},{type:"save",label:"Save",
|
||||
preSave:function(){delete i.startVariableName;delete i.startVariableOperator;delete i.startVariableValue;delete i.endVariableName;delete i.endVariableOperator;delete i.endVariableValue;delete i.completetime;delete i.scheduletime},"function":function(){var c=i.params,h;for(h in c)c[h]===null?delete c[h]:h in A||delete c[h];if(i.startVariableName||i.endVariableName){i.scheduletime=0;i.completetime=0}if(i.startVariableName===null){delete i.startVariableName;delete i.startVariableOperator;delete i.startVariableValue}if(i.endVariableName===
|
||||
null){delete i.endVariableName;delete i.endVariableOperator;delete i.endVariableValue}if(i.scheduletime)c.recstartunix=i.scheduletime;if(Object.keys(c).length||i.custom_url_params&&i.custom_url_params.length){var e=[];for(h in c)e.push(h+"="+c[h]);for(h in i.custom_url_params)e.push(i.custom_url_params[h]);i.target=i.target+("?"+e.join("&"))}delete i.params;delete i.custom_url_params;c={};c[b=="auto"?"push_auto_add":"push_start"]=i;if(typeof g!="undefined"&&(g[0]!=i.stream||g[1]!=i.target))c.push_auto_remove=
|
||||
[g];mist.send(function(){d[0]&&d[0]!=a?UI.navto(d[0],d[1]):UI.navto("Push")},c)}}]});c.append(UI.buildUI(k))}};mist.data.LTS?mist.send(function(a){(w=a.active_streams)||(w=[]);var a=[],b;for(b in w)w[b].indexOf("+")!=-1&&a.push(w[b].replace(/\+.*/,"")+"+");w=w.concat(a);var c=0,d=0;for(b in mist.data.streams){w.push(b);if(mist.inputMatch(UI.findInput("Folder").source_match,mist.data.streams[b].source)){w.push(b+"+");mist.send(function(a,b){var g=b.stream,h;for(h in a.browse.files)for(var e in mist.data.capabilities.inputs)e.indexOf("Buffer")>=
|
||||
0||(e.indexOf("Folder")>=0||e.indexOf("Buffer.exe")>=0||e.indexOf("Folder.exe")>=0)||mist.inputMatch(mist.data.capabilities.inputs[e].source_match,"/"+a.browse.files[h])&&w.push(g+"+"+a.browse.files[h]);d++;if(c==d){w=w.filter(function(a,b,c){return c.lastIndexOf(a)===b}).sort();R()}},{browse:mist.data.streams[b].source},{stream:b});c++}}if(c==d){w=w.filter(function(a,b,c){return c.lastIndexOf(a)===b}).sort();R()}},{active_streams:1}):(w=Object.keys(mist.data.streams),R());break;case "Triggers":if(!("triggers"in
|
||||
mist.data.config)||!mist.data.config.triggers)mist.data.config.triggers={};z=$("<tbody>");h=$("<table>").html($("<thead>").html($("<tr>").html($("<th>").text("Trigger on").attr("data-sort-type","string").addClass("sorting-asc")).append($("<th>").text("Applies to").attr("data-sort-type","string")).append($("<th>").text("Handler").attr("data-sort-type","string")).append($("<th>")))).append(z);c.append(UI.buildUI([{type:"help",help:"Triggers are a way to react to events that occur inside MistServer. These allow you to block specific users, redirect streams, keep tabs on what is being pushed where, etcetera. For full documentation, please refer to the developer documentation section on the MistServer website."}])).append($("<button>").text("New trigger").click(function(){UI.navto("Edit Trigger")})).append(h);
|
||||
h.stupidtable();h=mist.data.config.triggers;for(p in h)for(j in h[p])e=triggerRewrite(h[p][j]),z.append($("<tr>").attr("data-index",p+","+j).append($("<td>").text(p)).append($("<td>").text("streams"in e?e.streams.join(", "):"")).append($("<td>").text(e.handler)).append($("<td>").html($("<button>").text("Edit").click(function(){UI.navto("Edit Trigger",$(this).closest("tr").attr("data-index"))})).append($("<button>").text("Delete").click(function(){var a=$(this).closest("tr").attr("data-index").split(",");
|
||||
if(confirm("Are you sure you want to delete this "+a[0]+" trigger?")){mist.data.config.triggers[a[0]].splice(a[1],1);mist.data.config.triggers[a[0]].length==0&&delete mist.data.config.triggers[a[0]];mist.send(function(){UI.navto("Triggers")},{config:mist.data.config})}}))));break;case "Edit Trigger":if(!("triggers"in mist.data.config)||!mist.data.config.triggers)mist.data.config.triggers={};if("undefined"==typeof mist.data.capabilities){mist.send(function(){UI.showTab(a,b,d)},{capabilities:!0});c.append("Loading..");
|
||||
return}b?(b=b.split(","),j=triggerRewrite(mist.data.config.triggers[b[0]][b[1]]),r={triggeron:b[0],appliesto:j.streams,url:j.handler,async:j.sync,"default":j["default"],params:j.params}):(c.html($("<h2>").text("New Trigger")),r={});j=[];for(p in mist.data.capabilities.triggers)j.push([p,p+": "+mist.data.capabilities.triggers[p].when]);var Y=$("<div>").addClass("desc"),na=$("<div>");c.append(UI.buildUI([{label:"Trigger on",pointer:{main:r,index:"triggeron"},help:"For what event this trigger should activate.",
|
||||
type:"select",select:j,validate:["required"],"function":function(){var a=$(this).getval(),b=mist.data.capabilities.triggers[a];Y.html("");if(b){a=[$("<h4>").text("Trigger properties"),{type:"help",help:'The trigger "<i>'+a+'</i>" has the following properties:'},{type:"span",label:"Triggers",value:b.when,help:"When this trigger is activated"}];b.payload!=""&&a.push({label:"Payload",type:"textarea",value:b.payload,rows:b.payload.split("\n").length,readonly:true,clipboard:true,help:"The information this trigger sends to the handler."});
|
||||
a.push({type:"span",label:"Requires response",value:function(a){switch(a){case "ignored":return"No. The trigger will ignore the response of the handler.";case "always":return"Yes. The trigger needs a response to proceed.";case "when-blocking":return"The trigger needs a response to proceed if it is configured to be blocking.";default:return a}}(b.response),help:"Whether this trigger requires a response from the trigger handler"});a.push({type:"span",label:"Response action",value:b.response_action,
|
||||
help:"What this trigger will do with its handler's response"});Y.append(UI.buildUI(a));b.stream_specific?$("[name=appliesto]").closest(".UIelement").show():$("[name=appliesto]").setval([]).closest(".UIelement").hide();if(b.argument){$("[name=params]").closest(".UIelement").show();na.text(b.argument)}else $("[name=params]").setval("").closest(".UIelement").hide()}}},Y,$("<h4>").text("Trigger settings"),{label:"Applies to",pointer:{main:r,index:"appliesto"},help:"For triggers that can apply to specific streams, this value decides what streams they are triggered for. (none checked = always triggered)",
|
||||
type:"checklist",checklist:Object.keys(mist.data.streams),value:""!=d[1]?[d[1]]:[]},$("<br>"),{label:"Handler (URL or executable)",help:"This can be either an HTTP URL or a full path to an executable.",pointer:{main:r,index:"url"},validate:["required"],type:"str"},{label:"Blocking",type:"checkbox",help:"If checked, pauses processing and uses the response of the handler. If the response does not start with 1, true, yes or cont, further processing is aborted. If unchecked, processing is never paused and the response is not checked.",
|
||||
pointer:{main:r,index:"async"}},{label:"Parameters",type:"str",help:$("<div>").text("The extra data you want this trigger to use.").append(na),pointer:{main:r,index:"params"}},{label:"Default response",type:"str",help:"The default response in case the handler fails or is set to non-blocking.",placeholder:"true",pointer:{main:r,index:"default"}},{type:"buttons",buttons:[{type:"cancel",label:"Cancel","function":function(){d[0]&&d[0]!=a?UI.navto(d[0],d[1]):UI.navto("Triggers")}},{type:"save",label:"Save",
|
||||
"function":function(){b&&mist.data.config.triggers[b[0]].splice(b[1],1);var c={handler:r.url,sync:r.async?true:false,streams:typeof r.appliesto=="undefined"?[]:r.appliesto,params:r.params,"default":r["default"]};if(!("triggers"in mist.data.config))mist.data.config.triggers={};r.triggeron in mist.data.config.triggers||(mist.data.config.triggers[r.triggeron]=[]);mist.data.config.triggers[r.triggeron].push(c);mist.send(function(){d[0]&&d[0]!=a?UI.navto(d[0],d[1]):UI.navto("Triggers")},{config:mist.data.config})}}]}]));
|
||||
$("[name=triggeron]").trigger("change");break;case "Logs":var oa=$("<button>").text("Refresh now").click(function(){$(this).text("Loading..");mist.send(function(){Z();oa.text("Refresh now")})}).css("padding","0.2em 0.5em").css("flex-grow",0);c.append(UI.buildUI([{type:"help",help:"Here you have an overview of all edited settings within MistServer and possible warnings or errors MistServer has encountered. MistServer stores up to 100 logs at a time."},{label:"Refresh every",type:"select",select:[[10,
|
||||
"10 seconds"],[30,"30 seconds"],[60,"minute"],[300,"5 minutes"]],value:30,"function":function(){UI.interval.clear();UI.interval.set(function(){mist.send(function(){Z()})},$(this).val()*1E3)},help:"How often the table below should be updated."},{label:"..or",type:"DOMfield",DOMfield:oa,help:"Instantly refresh the table below."}]));c.append($("<button>").text("Purge logs").click(function(){mist.send(function(){mist.data.log=[];UI.navto("Logs")},{clearstatlogs:true})}));z=$("<tbody>").css("font-size",
|
||||
"0.9em");c.append($("<table>").addClass("logs").append(z));var qa=function(a){var b=$("<span>").text(a);switch(a){case "WARN":b.addClass("orange");break;case "ERROR":case "FAIL":b.addClass("red")}return b},Z=function(){var a=mist.data.log;if(a){a.length>=2&&a[0][0]<a[a.length-1][0]&&a.reverse();z.html("");for(var b in a){var c=$("<span>").addClass("content"),d=a[b][2].split("|"),g;for(g in d)c.append($("<span>").text(d[g]));z.append($("<tr>").html($("<td>").text(UI.format.dateTime(a[b][0],"long")).css("white-space",
|
||||
"nowrap")).append($("<td>").html(qa(a[b][1])).css("text-align","center")).append($("<td>").html(c).css("text-align","left")))}}};Z();break;case "Statistics":var F=$("<span>").text("Loading..");c.append(F);var r={graph:"new"},y=mist.stored.get().graphs?$.extend(!0,{},mist.stored.get().graphs):{},O={};for(p in mist.data.streams)O[p]=!0;for(p in mist.data.active_streams)O[mist.data.active_streams[p]]=!0;var O=Object.keys(O).sort(),aa=[];for(p in mist.data.config.protocols)aa.push(mist.data.config.protocols[p].connector);
|
||||
aa.sort();mist.send(function(){UI.plot.datatype.templates.cpuload.cores=0;for(var a in mist.data.capabilities.cpu)UI.plot.datatype.templates.cpuload.cores=UI.plot.datatype.templates.cpuload.cores+mist.data.capabilities.cpu[a].cores;F.html(UI.buildUI([{type:"help",help:"Here you will find the MistServer stream statistics, you can select various categories yourself. All statistics are live: up to five minutes are saved."},$("<h3>").text("Select the data to display"),{label:"Add to",type:"select",select:[["new",
|
||||
"New graph"]],pointer:{main:r,index:"graph"},classes:["graph_ids"],"function":function(){if($(this).val()){var a=F.find(".graph_xaxis"),b=F.find(".graph_id");if($(this).val()=="new"){a.children("option").prop("disabled",false);b.setval("Graph "+(Object.keys(y).length+1)).closest("label").show()}else{var c=y[$(this).val()].xaxis;a.children("option").prop("disabled",true).filter('[value="'+c+'"]').prop("disabled",false);b.closest("label").hide()}a.children('option[value="'+a.val()+'"]:disabled').length&&
|
||||
a.val(a.children("option:enabled").first().val());a.trigger("change")}}},{label:"Graph id",type:"str",pointer:{main:r,index:"id"},classes:["graph_id"],validate:[function(a){return a in y?{msg:"This graph id has already been used. Please enter something else.",classes:["red"]}:false}]},{label:"Axis type",type:"select",select:[["time","Time line"]],pointer:{main:r,index:"xaxis"},value:"time",classes:["graph_xaxis"],"function":function(){$s=F.find(".graph_datatype");switch($(this).getval()){case "coords":$s.children("option").prop("disabled",
|
||||
true).filter('[value="coords"]').prop("disabled",false);break;case "time":$s.children("option").prop("disabled",false).filter('[value="coords"]').prop("disabled",true)}if(!$s.val()||$s.children('option[value="'+$s.val()+'"]:disabled').length){$s.val($s.children("option:enabled").first().val());$s.trigger("change")}}},{label:"Data type",type:"select",select:[["clients","Connections"],["upbps","Bandwidth (up)"],["downbps","Bandwidth (down)"],["cpuload","CPU use"],["memload","Memory load"],["coords",
|
||||
"Client location"],["perc_lost","Lost packages"],["perc_retrans","Re-transmitted packages"]],pointer:{main:r,index:"datatype"},classes:["graph_datatype"],"function":function(){$s=F.find(".graph_origin");switch($(this).getval()){case "cpuload":case "memload":$s.find("input[type=radio]").not('[value="total"]').prop("disabled",true);$s.find('input[type=radio][value="total"]').prop("checked",true);break;default:$s.find("input[type=radio]").prop("disabled",false)}}},{label:"Data origin",type:"radioselect",
|
||||
radioselect:[["total","All"],["stream","The stream:",O],["protocol","The protocol:",aa]],pointer:{main:r,index:"origin"},value:["total"],classes:["graph_origin"]},{type:"buttons",buttons:[{label:"Add data set",type:"save","function":function(){var a;if(r.graph=="new"){a=UI.plot.addGraph(r,b);y[a.id]=a;F.find("input.graph_id").val("");F.find("select.graph_ids").append($("<option>").text(a.id)).val(a.id).trigger("change")}else a=y[r.graph];var c=UI.plot.datatype.getOptions({datatype:r.datatype,origin:r.origin});
|
||||
a.datasets.push(c);UI.plot.save(a);UI.plot.go(y)}}]}]));var b=$("<div>").addClass("graph_container");c.append(b);var d=F.find("select.graph_ids");for(a in y){var g=UI.plot.addGraph(y[a],b);d.append($("<option>").text(g.id)).val(g.id);var h=[],e;for(e in y[a].datasets){var f=UI.plot.datatype.getOptions({datatype:y[a].datasets[e].datatype,origin:y[a].datasets[e].origin});h.push(f)}g.datasets=h;y[g.id]=g}d.trigger("change");UI.plot.go(y);UI.interval.set(function(){UI.plot.go(y)},1E4)},{active_streams:!0,
|
||||
capabilities:!0});break;case "Server Stats":if("undefined"==typeof mist.data.capabilities){mist.send(function(){UI.showTab(a)},{capabilities:!0});c.append("Loading..");return}var ba=$("<table>"),I=$("<table>"),j={vheader:"CPUs",labels:["Model","Processor speed","Amount of cores","Amount of threads"],content:[]};for(p in mist.data.capabilities.cpu)h=mist.data.capabilities.cpu[p],j.content.push({header:"CPU #"+(Number(p)+1),body:[h.model,UI.format.addUnit(UI.format.number(h.mhz),"MHz"),h.cores,h.threads]});
|
||||
p=UI.buildVheaderTable(j);var pa=function(){var a=mist.data.capabilities.mem,b=mist.data.capabilities.load,a={vheader:"Memory",labels:["Used","Cached","Available","Total"],content:[{header:"Physical memory",body:[UI.format.bytes(a.used*1048576)+" ("+UI.format.addUnit(b.memory,"%")+")",UI.format.bytes(a.cached*1048576),UI.format.bytes(a.free*1048576),UI.format.bytes(a.total*1048576)]},{header:"Swap memory",body:[UI.format.bytes((a.swaptotal-a.swapfree)*1048576),UI.format.addUnit("","N/A"),UI.format.bytes(a.swapfree*
|
||||
1048576),UI.format.bytes(a.swaptotal*1048576)]}]},a=UI.buildVheaderTable(a);ba.replaceWith(a);ba=a;b={vheader:"Load average",labels:["CPU use","1 minute","5 minutes","15 minutes"],content:[{header:" ",body:[UI.format.addUnit(UI.format.number(mist.data.capabilities.cpu_use/10),"%"),UI.format.number(b.one/100),UI.format.number(b.five/100),UI.format.number(b.fifteen/100)]}]};b=UI.buildVheaderTable(b);I.replaceWith(b);I=b};pa();c.append(UI.buildUI([{type:"help",help:"You can find general server statistics here. Note that memory and CPU usage is for your entire machine, not just MistServer."}])).append($("<table>").css("width",
|
||||
"auto").addClass("nolay").append($("<tr>").append($("<td>").append(ba)).append($("<td>").append(I))).append($("<tr>").append($("<td>").append(p).attr("colspan",2))));UI.interval.set(function(){mist.send(function(){pa()},{capabilities:true})},3E4);break;case "Email for Help":p=$.extend({},mist.data);delete p.statistics;delete p.totals;delete p.clients;delete p.capabilities;p=JSON.stringify(p);p="Version: "+mist.data.config.version+"\n\nConfig:\n"+p;r={};c.append(UI.buildUI([{type:"help",help:"You can use this form to email MistServer support if you're having difficulties.<br>A copy of your server config file will automatically be included."},
|
||||
{type:"str",label:"Your name",validate:["required"],pointer:{main:r,index:"name"},value:mist.user.name},{type:"email",label:"Your email address",validate:["required"],pointer:{main:r,index:"email"}},{type:"hidden",value:"Integrated Help",pointer:{main:r,index:"subject"}},{type:"hidden",value:"-",pointer:{main:r,index:"company"}},{type:"textarea",rows:20,label:"Your message",validate:["required"],pointer:{main:r,index:"message"}},{type:"textarea",rows:20,label:"Your config file",readonly:!0,value:p,
|
||||
pointer:{main:r,index:"configfile"}},{type:"buttons",buttons:[{type:"save",label:"Send","function":function(a){$(a).text("Sending..");$.ajax({type:"POST",url:"https://mistserver.org/contact?skin=plain",data:r,success:function(a){a=$("<span>").html(a);a.find("script").remove();c.html(a[0].innerHTML)}})}}]}]));break;case "Disconnect":mist.user.password="";delete mist.user.authstring;delete mist.user.loggedin;sessionStorage.removeItem("mistLogin");UI.navto("Login");break;default:c.append($("<p>").text("This tab does not exist."))}c.find(".field").filter(function(){var a=
|
||||
|
@ -312,9 +311,9 @@ return c},embedurls:function(a,b,d){function c(){function b(a){switch(typeof a){
|
|||
c+'">');k.push(" <noscript>");k.push(' <a href="'+n+j+'.html" target="_blank">');k.push(" Click here to play this video");k.push(" </a>");k.push(" </noscript>");k.push(" <script>");k.push(" var a = function(){");k.push(' mistPlay("'+a+'",{');k.push(" "+e.join(",\n "));k.push(" });");k.push(" };");k.push(" if (!window.mistplayers) {");k.push(' var p = document.createElement("script");');d.HTTPS.length?(k.push(' if (location.protocol == "https:") { p.src = "'+
|
||||
("https://"==parseURL(n).protocol?n:d.HTTPS[0])+'player.js" } '),k.push(' else { p.src = "'+("http://"==parseURL(n).protocol?n:d.HTTP[0])+'player.js" } ')):k.push(' p.src = "'+n+'player.js"');k.push(" document.head.appendChild(p);");k.push(" p.onload = a;");k.push(" }");k.push(" else { a(); }");k.push(" <\/script>");k.push("</div>");return k.join("\n")}function e(d){UI.sockets.ws.info_json.subscribe(function(a){if("error"==a.type)if(d==n)e(b);else throw a;else{if("source"in
|
||||
a&&(!q||a.source.length)){var g=d==n?!1:n,f=[],i=l.find(".field.forceType"),j=l.find(".field.prioritize_type");g&&(g=g.replace(parseURL(g).protocol,""),f.push($("<div>").addClass("orange").html('Warning: the provided base URL <a href="'+n+'">'+n+"</a> could not be reached. These links are my best guess but will probably not work properly.").css({margin:"0.5em 0",width:"45em","word-break":"normal"})));for(var m in a.source){var s=a.source[m],C=UI.humanMime(s.type),u=s.url;g&&(u=parseURL(s.url).protocol+
|
||||
g+s.relurl);var D=u.match(/[\?\&]tkn=\d+\&?/);D&&(D=D[0],u=u.replace(D,"?"==D[0]&&"&"==D.slice(-1)?"?":"&"==D.slice(-1)?"&":""));f.push({label:C?C+" <span class=description>("+s.type+")</span>":UI.format.capital(s.type),type:"str",value:u,readonly:!0,qrcode:!0,clipboard:!0});C=UI.humanMime(s.type);0==i.children('option[value="'+s.type+'"]').length&&(i.append($("<option>").text(C?C+" ("+s.type+")":UI.format.capital(s.type)).val(s.type)),j.append($("<option>").text(C?C+" ("+s.type+")":UI.format.capital(s.type)).val(s.type)))}i.val(h.forceType);
|
||||
g+s.relurl);var E=u.match(/[\?\&]tkn=\d+\&?/);E&&(E=E[0],u=u.replace(E,"?"==E[0]&&"&"==E.slice(-1)?"?":"&"==E.slice(-1)?"&":""));f.push({label:C?C+" <span class=description>("+s.type+")</span>":UI.format.capital(s.type),type:"str",value:u,readonly:!0,qrcode:!0,clipboard:!0});C=UI.humanMime(s.type);0==i.children('option[value="'+s.type+'"]').length&&(i.append($("<option>").text(C?C+" ("+s.type+")":UI.format.capital(s.type)).val(s.type)),j.append($("<option>").text(C?C+" ("+s.type+")":UI.format.capital(s.type)).val(s.type)))}i.val(h.forceType);
|
||||
j.val(h.prioritize_type);o.html(UI.buildUI(f));q=!0}if("meta"in a&&"tracks"in a.meta){var g={},v;for(v in a.meta.tracks)if(f=a.meta.tracks[v],"subtitle"==f.codec&&(f.type="subtitle"),!("audio"!=f.type&&"video"!=f.type&&"subtitle"!=f.type))f.type in g||(g[f.type]="subtitle"==f.type?[]:[["","Autoselect "+f.type]]),g[f.type].push([f.trackid,UI.format.capital(f.type)+" track "+(g[f.type].length+("subtitle"==f.type?1:0))]);k.html("");if(Object.keys(g).length){k.closest("label").show();var a=["audio","video",
|
||||
"subtitle"],A;for(A in a)if(v=a[A],g[v]&&g[v].length){f=$("<select>").attr("data-type",v).css("flex-grow","1").change(function(){""==$(this).val()?delete h.setTracks[$(this).attr("data-type")]:h.setTracks[$(this).attr("data-type")]=$(this).val();$(".embed_code").setval(c(h))});k.append(f);"subtitle"==v?g[v].unshift(["","No "+v]):g[v].push([-1,"No "+v]);for(var L in g[v])f.append($("<option>").val(g[v][L][0]).text(g[v][L][1]));v in h.setTracks&&(f.val(h.setTracks[v]),null==f.val()&&(f.val(""),delete h.setTracks[v],
|
||||
"subtitle"],z;for(z in a)if(v=a[z],g[v]&&g[v].length){f=$("<select>").attr("data-type",v).css("flex-grow","1").change(function(){""==$(this).val()?delete h.setTracks[$(this).attr("data-type")]:h.setTracks[$(this).attr("data-type")]=$(this).val();$(".embed_code").setval(c(h))});k.append(f);"subtitle"==v?g[v].unshift(["","No "+v]):g[v].push([-1,"No "+v]);for(var L in g[v])f.append($("<option>").val(g[v][L][0]).text(g[v][L][1]));v in h.setTracks&&(f.val(h.setTracks[v]),null==f.val()&&(f.val(""),delete h.setTracks[v],
|
||||
$(".embed_code").setval(c(h))))}}else k.closest("label").hide()}}},a,d.replace(/^http/,"ws")+"json_"+encodeURIComponent(a)+".js",!1,"?inclzero=1")}var l=$("<section>").addClass("embedurls"),i=$("<datalist>").attr("id","urlhints"),f=d.HTTPS.concat(d.HTTP),m;for(m in f)i.append($("<option>").val(f[m]));var n=otherhost.host?otherhost.host:f.length?f[0]:b;l.append($("<span>").addClass("input_container").append($("<label>").addClass("UIelement").append($("<span>").addClass("label").text("Use base URL:")).append($("<span>").addClass("field_container").append($("<input>").attr("type",
|
||||
"text").addClass("field").val(n).attr("list","urlhints")).append(i).append($("<span>").addClass("unit").append($("<button>").text("Apply").click(function(){otherhost.host=$(this).closest("label").find("input").val();"/"!=otherhost.host.slice(-1)&&(otherhost.host+="/");UI.navto("Embed",a)}))))));var j=encodeURIComponent(a),q=!1,g={forcePlayer:"",forceType:"",controls:!0,autoplay:!0,loop:!1,muted:!1,fillSpace:!1,poster:"",urlappend:"",setTracks:{}},h=$.extend({},g),i=UI.stored.getOpts();"embedoptions"in
|
||||
i&&(h=$.extend(h,i.embedoptions,!0),"object"!=typeof h.setTracks&&(h.setTracks={}));i={};switch(h.controls){case "stock":i.controls="stock";break;case !0:i.controls=1;break;case !1:i.controls=0}var f=c(h),k=$("<div>").text("Loading..").css("display","flex").css("flex-flow","column nowrap"),o=$("<span>").text("Loading..").css("word-break","break-all");if(mistplayers){var s=[["","Automatic"]];for(m in mistplayers)s.push([m,mistplayers[m].name])}l.append(UI.buildUI([$("<h3>").text("Urls"),{label:"Stream info json",
|
||||
|
@ -342,10 +341,12 @@ mist.data.totals[stream]||(mist.data.totals[stream][protocol]={});$.extend(mist.
|
|||
"")UI.navto("Login");else{mist.user.authstring=e.authorize.challenge;mist.send(a,b,d);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,d);break;default:UI.navto("Login")}}};d.hide||UI.elements.connection.msg.removeClass("red").text("Data sent, waiting for a reply..").append($("<br>")).append($("<a>").text("Cancel request").click(function(){l.abort()}));
|
||||
var l=$.ajax(e)},inputMatch:function(a,b){if(typeof a=="undefined")return false;typeof a=="string"&&(a=[a]);for(var d in a){var c=a[d].replace(/[^\w\s]/g,"\\$&"),c=c.replace(/\\\*/g,".*");if(RegExp("^(?:[a-zA-Z]:)?"+c+"(?:\\?[^\\?]*)?$","i").test(b))return true}return false},convertBuildOptions:function(a,b){function d(a,c,d){var f={label:UI.format.capital(d.name?d.name:c),pointer:{main:b,index:c},validate:[]};e[a]=="required"&&(!("default"in d)||d["default"]=="")&&f.validate.push("required");if("default"in
|
||||
d){f.placeholder=d["default"];if(d.type=="select")for(var i in d.select)if(d.select[i][0]==d["default"]){f.placeholder=d.select[i][1];break}}if("help"in d)f.help=d.help;if("unit"in d)f.unit=d.unit;if("placeholder"in d)f.placeholder=d.placeholder;if("datalist"in d)f.datalist=d.datalist;if("type"in d)switch(d.type){case "int":f.type="int";if("max"in d)f.max=d.max;if("min"in d)f.min=d.min;break;case "uint":f.type="int";f.min=0;if("max"in d)f.max=d.max;if("min"in d)f.min=Math.max(f.min,d.min);break;case "radioselect":f.type=
|
||||
"radioselect";f.radioselect=d.radioselect;break;case "select":f.type="select";f.select=d.select.slice(0);f.validate.indexOf("required")>=0&&f.select.unshift(["","placeholder"in f?"Default ("+f.placeholder+")":""]);break;case "sublist":f.type="sublist";f.saveas={};f.itemLabel=d.itemLabel;f.sublist=mist.convertBuildOptions(d,f.saveas);break;case "group":a=mist.convertBuildOptions({optional:d.options},b);a=a.slice(1);"help"in d&&a.unshift($("<span>").addClass("description").text(d.help));"name"in d&&
|
||||
a.unshift($("<b>").text(d.name));return $("<div>").addClass("itemsettings").append(UI.buildUI(a));case "bool":f.type="checkbox";break;case "unixtime":f.type="unix";break;case "json":case "debug":case "inputlist":f.type=d.type;break;default:f.type="str"}else f.type="checkbox";if("format"in d)switch(d.format){case "set_or_unset":f.postSave=function(){var a=$(this).data("pointer");a.main[a.index]||delete a.main[a.index]}}"influences"in d?f["function"]=function(){var a=$(this).closest(".UIelement"),b=
|
||||
a.find("style");if(b.length)b=b[0];else{b=$("<style>").addClass("dependencies")[0];a.append(b)}b.innerHTML=".UIelement[data-dependent-"+c+"]:not([data-dependent-"+c+'~="'+$(this).getval()+'"]) { display: none; }\n';$(b).data("content",b.innerHTML);$("style.dependencies.hidden").each(function(){$(this).html($(this).data("content")).removeClass("hidden")});$(".UIelement:not(:visible) style.dependencies:not(.hidden)").each(function(){$(this).addClass("hidden");$(this).html("")})}:"disable"in d&&(f["function"]=
|
||||
function(){for(var a=$(this).closest(".input_container"),b=$(this).getval(),c=0;c<d.disable.length;c++){var e=a.find('.field[name="'+d.disable[c]+'"]').closest(".UIelement");if(e.length)b==""?e[0].style.display="":e.hide()}});if("dependent"in d)f.dependent=d.dependent;if("value"in d)f.value=d.value;if("validate"in d){f.validate=f.validate.concat(d.validate);if(d.validate.indexOf("track_selector_parameter")>-1)f.help="<div>"+d.help+"</div><p>Track selector parameters consist of a string value which may be any of the following:</p> <ul><li><code>selector,selector</code>: Selects the union of the given selectors. Any number of comma-separated selector combinations may be used, they are evaluated one by one from left to right.</li> <li><code>selector,!selector</code>: Selects the difference of the given selectors. Specifically, all tracks part of the first selector that are not part of the second selector. Any number of comma-separated selector combinations may be used, they are evaluated one by one from left to right.</li> <li><code>selector,|selector</code>: Selects the intersection of the given selectors. Any number of comma-separated selector combinations may be used, they are evaluated one by one from left to right.</li> <li><code>none</code> or <code>-1</code>: Selects no tracks of this type.</li> <li><code>all</code> or <code>*</code>: Selects all tracks of this type.</li> <li>Any positive integer: Select this specific track ID. Does not apply if the given track ID does not exist or is of the wrong type. <strong>Does</strong> apply if the given track ID is incompatible with the currently active protocol or container format.</li> <li>ISO 639-1/639-3 language code: Select all tracks marked as the given language. Case insensitive.</li> <li>Codec string (e.g. <code>h264</code>): Select all tracks of the given codec. Case insensitive.</li> <li><code>highbps</code>, <code>maxbps</code> or <code>bestbps</code>: Select the track of this type with the highest bit rate.</li> <li><code>lowbps</code>, <code>minbps</code> or <code>worstbps</code>: Select the track of this type with the lowest bit rate.</li> <li><code>Xbps</code> or <code>Xkbps</code> or <code>Xmbps</code>: Select the single of this type which has a bit rate closest to the given number X. This number is in bits, not bytes.</li> <li><code>>Xbps</code> or <code>>Xkbps</code> or <code>>Xmbps</code>: Select all tracks of this type which have a bit rate greater than the given number X. This number is in bits, not bytes.</li> <li><code><Xbps</code> or <code><Xkbps</code> or <code><Xmbps</code>: Select all tracks of this type which have a bit rate less than the given number X. This number is in bits, not bytes.</li> <li><code>max<Xbps</code> or <code>max<Xkbps</code> or <code>max<Xmbps</code>: Select the one track of this type which has the highest bit rate less than the given number X. This number is in bits, not bytes.</li> <li><code>highres</code>, <code>maxres</code> or <code>bestres</code>: Select the track of this type with the highest pixel surface area. Only applied when the track type is video.</li> <li><code>lowres</code>, <code>minres</code> or <code>worstres</code>: Select the track of this type with the lowest pixel surface area. Only applied when the track type is video.</li> <li><code>XxY</code>: Select all tracks of this type with the given pixel surface area in X by Y pixels. Only applied when the track type is video.</li> <li><code>~XxY</code>: Select the single track of this type closest to the given pixel surface area in X by Y pixels. Only applied when the track type is video.</li> <li><code>>XxY</code>: Select all tracks of this type with a pixel surface area greater than X by Y pixels. Only applied when the track type is video.</li> <li><code><XxY</code>: Select all tracks of this type with a pixel surface area less than X by Y pixels. Only applied when the track type is video.</li> <li><code>720p</code>, <code>1080p</code>, <code>1440p</code>, <code>2k</code>, <code>4k</code>, <code>5k</code>, or <code>8k</code>: Select all tracks of this type with the given pixel surface area. Only applied when the track type is video.</li> <li><code>surround</code>, <code>mono</code>, <code>stereo</code>, <code>Xch</code>: Select all tracks of this type with the given channel count. The 'Xch' variant can use any positive integer for 'X'. Only applied when the track type is audio.</li></ul>";
|
||||
"radioselect";f.radioselect=d.radioselect;break;case "select":f.type="select";f.select=d.select.slice(0);f.validate.indexOf("required")>=0&&f.select.unshift(["","placeholder"in f?"Default ("+f.placeholder+")":""]);break;case "sublist":f.type="sublist";f.saveas={};f.itemLabel=d.itemLabel;f.sublist=mist.convertBuildOptions(d,f.saveas);break;case "group":var j=$("<div>").addClass("itemgroup"),a=mist.convertBuildOptions({optional:d.options},b),a=a.slice(1),l=$("<ul>").addClass("summary");a.unshift(l);
|
||||
"help"in d&&a.unshift($("<span>").addClass("description").text(d.help));"name"in d&&a.unshift($("<b>").text(d.name).click(function(){j.toggleClass("expanded")}).attr("title","Click to show / hide these options"));(d.expand||d.expand!==false&&Object.keys(d.options).length<2)&&j.addClass("expanded");return j.change(function(){l.html("");$(this).find('.isSetting, input[type="hidden"].isSetting').each(function(){var a=$(this).getval();if(a!=""){var b=$(this).data("opts");if(a!=b["default"]){var c=b.label+
|
||||
": ";switch(b.type){case "select":a=b.select.filter(function(b){return b[0]==a?true:false})[0][1];break;case "unix":a=UI.format.dateTime(a);break;case "checkbox":a="";c=c.slice(0,-2)}l.append($("<li>").addClass("setting").append($("<span>").addClass("label").text(c)).append($("<span>").text(a)).append($("<span>").addClass("unit").text(typeof b.unit=="string"?b.unit:"")))}}})}).append(UI.buildUI(a)).trigger("change");case "bool":f.type="checkbox";break;case "unixtime":f.type="unix";break;case "json":case "debug":case "inputlist":f.type=
|
||||
d.type;break;default:f.type="str"}else f.type="checkbox";if("format"in d)switch(d.format){case "set_or_unset":f.postSave=function(){var a=$(this).data("pointer");a.main[a.index]||delete a.main[a.index]}}"influences"in d?f["function"]=function(){var a=$(this).closest(".UIelement"),b=a.find("style");if(b.length)b=b[0];else{b=$("<style>").addClass("dependencies")[0];a.append(b)}b.innerHTML=".UIelement[data-dependent-"+c+"]:not([data-dependent-"+c+'~="'+$(this).getval()+'"]) { display: none; }\n';$(b).data("content",
|
||||
b.innerHTML);$("style.dependencies.hidden").each(function(){$(this).html($(this).data("content")).removeClass("hidden")});$(".UIelement:not(:visible) style.dependencies:not(.hidden)").each(function(){$(this).addClass("hidden");$(this).html("")})}:"disable"in d&&(f["function"]=function(){for(var a=$(this).closest(".input_container"),b=$(this).getval(),c=0;c<d.disable.length;c++){var e=a.find('.field[name="'+d.disable[c]+'"]').closest(".UIelement");if(e.length)b==""?e[0].style.display="":e.hide()}});
|
||||
if("dependent"in d)f.dependent=d.dependent;if("value"in d)f.value=d.value;if("validate"in d){f.validate=f.validate.concat(d.validate);if(d.validate.indexOf("track_selector_parameter")>-1)f.help="<div>"+d.help+"</div><p>Track selector parameters consist of a string value which may be any of the following:</p> <ul><li><code>selector,selector</code>: Selects the union of the given selectors. Any number of comma-separated selector combinations may be used, they are evaluated one by one from left to right.</li> <li><code>selector,!selector</code>: Selects the difference of the given selectors. Specifically, all tracks part of the first selector that are not part of the second selector. Any number of comma-separated selector combinations may be used, they are evaluated one by one from left to right.</li> <li><code>selector,|selector</code>: Selects the intersection of the given selectors. Any number of comma-separated selector combinations may be used, they are evaluated one by one from left to right.</li> <li><code>none</code> or <code>-1</code>: Selects no tracks of this type.</li> <li><code>all</code> or <code>*</code>: Selects all tracks of this type.</li> <li>Any positive integer: Select this specific track ID. Does not apply if the given track ID does not exist or is of the wrong type. <strong>Does</strong> apply if the given track ID is incompatible with the currently active protocol or container format.</li> <li>ISO 639-1/639-3 language code: Select all tracks marked as the given language. Case insensitive.</li> <li>Codec string (e.g. <code>h264</code>): Select all tracks of the given codec. Case insensitive.</li> <li><code>highbps</code>, <code>maxbps</code> or <code>bestbps</code>: Select the track of this type with the highest bit rate.</li> <li><code>lowbps</code>, <code>minbps</code> or <code>worstbps</code>: Select the track of this type with the lowest bit rate.</li> <li><code>Xbps</code> or <code>Xkbps</code> or <code>Xmbps</code>: Select the single of this type which has a bit rate closest to the given number X. This number is in bits, not bytes.</li> <li><code>>Xbps</code> or <code>>Xkbps</code> or <code>>Xmbps</code>: Select all tracks of this type which have a bit rate greater than the given number X. This number is in bits, not bytes.</li> <li><code><Xbps</code> or <code><Xkbps</code> or <code><Xmbps</code>: Select all tracks of this type which have a bit rate less than the given number X. This number is in bits, not bytes.</li> <li><code>max<Xbps</code> or <code>max<Xkbps</code> or <code>max<Xmbps</code>: Select the one track of this type which has the highest bit rate less than the given number X. This number is in bits, not bytes.</li> <li><code>highres</code>, <code>maxres</code> or <code>bestres</code>: Select the track of this type with the highest pixel surface area. Only applied when the track type is video.</li> <li><code>lowres</code>, <code>minres</code> or <code>worstres</code>: Select the track of this type with the lowest pixel surface area. Only applied when the track type is video.</li> <li><code>XxY</code>: Select all tracks of this type with the given pixel surface area in X by Y pixels. Only applied when the track type is video.</li> <li><code>~XxY</code>: Select the single track of this type closest to the given pixel surface area in X by Y pixels. Only applied when the track type is video.</li> <li><code>>XxY</code>: Select all tracks of this type with a pixel surface area greater than X by Y pixels. Only applied when the track type is video.</li> <li><code><XxY</code>: Select all tracks of this type with a pixel surface area less than X by Y pixels. Only applied when the track type is video.</li> <li><code>720p</code>, <code>1080p</code>, <code>1440p</code>, <code>2k</code>, <code>4k</code>, <code>5k</code>, or <code>8k</code>: Select all tracks of this type with the given pixel surface area. Only applied when the track type is video.</li> <li><code>surround</code>, <code>mono</code>, <code>stereo</code>, <code>Xch</code>: Select all tracks of this type with the given channel count. The 'Xch' variant can use any positive integer for 'X'. Only applied when the track type is audio.</li></ul>";
|
||||
if(d.validate.indexOf("track_selector")>-1)f.help="<div>"+d.help+"</div><p>A track selector is at least one track type (audio, video or subtitle) combined with a track selector parameter. For example: <code>audio=none&video=maxres</code>.<p>Track selector parameters consist of a string value which may be any of the following:</p> <ul><li><code>selector,selector</code>: Selects the union of the given selectors. Any number of comma-separated selector combinations may be used, they are evaluated one by one from left to right.</li> <li><code>selector,!selector</code>: Selects the difference of the given selectors. Specifically, all tracks part of the first selector that are not part of the second selector. Any number of comma-separated selector combinations may be used, they are evaluated one by one from left to right.</li> <li><code>selector,|selector</code>: Selects the intersection of the given selectors. Any number of comma-separated selector combinations may be used, they are evaluated one by one from left to right.</li> <li><code>none</code> or <code>-1</code>: Selects no tracks of this type.</li> <li><code>all</code> or <code>*</code>: Selects all tracks of this type.</li> <li>Any positive integer: Select this specific track ID. Does not apply if the given track ID does not exist or is of the wrong type. <strong>Does</strong> apply if the given track ID is incompatible with the currently active protocol or container format.</li> <li>ISO 639-1/639-3 language code: Select all tracks marked as the given language. Case insensitive.</li> <li>Codec string (e.g. <code>h264</code>): Select all tracks of the given codec. Case insensitive.</li> <li><code>highbps</code>, <code>maxbps</code> or <code>bestbps</code>: Select the track of this type with the highest bit rate.</li> <li><code>lowbps</code>, <code>minbps</code> or <code>worstbps</code>: Select the track of this type with the lowest bit rate.</li> <li><code>Xbps</code> or <code>Xkbps</code> or <code>Xmbps</code>: Select the single of this type which has a bit rate closest to the given number X. This number is in bits, not bytes.</li> <li><code>>Xbps</code> or <code>>Xkbps</code> or <code>>Xmbps</code>: Select all tracks of this type which have a bit rate greater than the given number X. This number is in bits, not bytes.</li> <li><code><Xbps</code> or <code><Xkbps</code> or <code><Xmbps</code>: Select all tracks of this type which have a bit rate less than the given number X. This number is in bits, not bytes.</li> <li><code>max<Xbps</code> or <code>max<Xkbps</code> or <code>max<Xmbps</code>: Select the one track of this type which has the highest bit rate less than the given number X. This number is in bits, not bytes.</li> <li><code>highres</code>, <code>maxres</code> or <code>bestres</code>: Select the track of this type with the highest pixel surface area. Only applied when the track type is video.</li> <li><code>lowres</code>, <code>minres</code> or <code>worstres</code>: Select the track of this type with the lowest pixel surface area. Only applied when the track type is video.</li> <li><code>XxY</code>: Select all tracks of this type with the given pixel surface area in X by Y pixels. Only applied when the track type is video.</li> <li><code>~XxY</code>: Select the single track of this type closest to the given pixel surface area in X by Y pixels. Only applied when the track type is video.</li> <li><code>>XxY</code>: Select all tracks of this type with a pixel surface area greater than X by Y pixels. Only applied when the track type is video.</li> <li><code><XxY</code>: Select all tracks of this type with a pixel surface area less than X by Y pixels. Only applied when the track type is video.</li> <li><code>720p</code>, <code>1080p</code>, <code>1440p</code>, <code>2k</code>, <code>4k</code>, <code>5k</code>, or <code>8k</code>: Select all tracks of this type with the given pixel surface area. Only applied when the track type is video.</li> <li><code>surround</code>, <code>mono</code>, <code>stereo</code>, <code>Xch</code>: Select all tracks of this type with the given channel count. The 'Xch' variant can use any positive integer for 'X'. Only applied when the track type is audio.</li></ul>"}return f}
|
||||
var c=[],e=["required","optional"];"desc"in a&&c.push({type:"help",help:a.desc});for(var l in e)if(a[e[l]]){c.push($("<h4>").text(UI.format.capital(e[l])+" parameters"));var i=Object.keys(a[e[l]]);"sort"in a&&i.sort(function(b,c){return(""+a[e[l]][b][a.sort]).localeCompare(a[e[l]][c][a.sort])});for(var f in i){var m=i[f],n=a[e[l]][m];if(Array.isArray(n))for(var j in n)c.push(d(l,m,n[j]));else c.push(d(l,m,n))}}return c},stored:{get:function(){return mist.data.ui_settings||{}},set:function(a,b){var d=
|
||||
this.get();d[a]=b;mist.send(function(){},{ui_settings:d})},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){}}
|
||||
|
|
183
lsp/mist.js
183
lsp/mist.js
|
@ -619,6 +619,9 @@ var UI = {
|
|||
|
||||
var $ic = $(this).closest('.input_container');
|
||||
|
||||
//ensure any grouped options (with non-default settings) are expanded
|
||||
$ic.find(".itemgroup:has(.summary:not(:empty))").addClass("expanded");
|
||||
|
||||
//skip any hidden fields
|
||||
|
||||
//validate
|
||||
|
@ -5795,7 +5798,8 @@ var UI = {
|
|||
var $autopush = $("<div>");
|
||||
var push_parameters, full_list_of_push_parameters;
|
||||
if (other == "auto") {
|
||||
$autopush.css("margin","1em 0").html(UI.buildUI([{
|
||||
$autopush.css("margin","1em 0").html(UI.buildUI([
|
||||
$("<h3>").text("Automatic push options"),{
|
||||
label: "This push should be active",
|
||||
help: "When 'based on server time' is selected, a start and/or end timestamp can be configured. When it's 'based on a variable', the push will be activated while the specified variable matches the specified value.",
|
||||
type: "select",
|
||||
|
@ -6042,37 +6046,39 @@ var UI = {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!match) {
|
||||
$additional_params.html(
|
||||
$("<h4>").addClass("red").text("Unrecognized target.")
|
||||
).append(
|
||||
$("<span>").text("Please edit the push target.")
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (!("friendly" in mist.data.capabilities.connectors[match])) { mist.data.capabilities.connectors[match].friendly = mist.data.capabilities.connectors[match].name; }
|
||||
if ($(this).data("last_match") == match) { return; }
|
||||
$(this).data("last_match",match);
|
||||
if (!match) {
|
||||
$additional_params.html(
|
||||
$("<h4>").addClass("red").text("Unrecognized target.")
|
||||
).append(
|
||||
$("<span>").text("Please edit the push target.")
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (!("friendly" in mist.data.capabilities.connectors[match])) { mist.data.capabilities.connectors[match].friendly = mist.data.capabilities.connectors[match].name; }
|
||||
$additional_params.html($("<h3>").text(mist.data.capabilities.connectors[match].friendly.replace("over HTTP","")));
|
||||
push_parameters = $.extend({},mist.data.capabilities.connectors[match].push_parameters);
|
||||
full_list_of_push_parameters = {};
|
||||
function processPushParam(param,key) {
|
||||
//filter out protocol only or file only options. This does not need to be dynamic as when the target changes, the whole $additional_params container is overwritten anyway
|
||||
if (param.prot_only && String().match && (val.match(/.+\:\/\/.+/) === null)) {
|
||||
delete push_parameters[key];
|
||||
return;
|
||||
}
|
||||
if (param.file_only && (val[0] != "/")) {
|
||||
delete push_parameters[key];
|
||||
return;
|
||||
}
|
||||
if (param.type == "group") {
|
||||
for (var i in param.options) {
|
||||
processPushParam(param.options[i],i);
|
||||
push_parameters = $.extend({},mist.data.capabilities.connectors[match].push_parameters);
|
||||
full_list_of_push_parameters = {};
|
||||
function processPushParam(param,key) {
|
||||
//filter out protocol only or file only options. This does not need to be dynamic as when the target changes, the whole $additional_params container is overwritten anyway
|
||||
if (param.prot_only && String().match && (val.match(/.+\:\/\/.+/) === null)) {
|
||||
delete push_parameters[key];
|
||||
return;
|
||||
}
|
||||
if (param.file_only && (val[0] != "/")) {
|
||||
delete push_parameters[key];
|
||||
return;
|
||||
}
|
||||
if (param.type == "group") {
|
||||
for (var i in param.options) {
|
||||
processPushParam(param.options[i],i);
|
||||
}
|
||||
}
|
||||
else {
|
||||
full_list_of_push_parameters[key] = param;
|
||||
}
|
||||
}
|
||||
else {
|
||||
full_list_of_push_parameters[key] = param;
|
||||
}
|
||||
}
|
||||
for (var i in mist.data.capabilities.connectors[match].push_parameters) {
|
||||
processPushParam(mist.data.capabilities.connectors[match].push_parameters[i],i);
|
||||
}
|
||||
|
@ -6083,13 +6089,14 @@ var UI = {
|
|||
sort: "sort"
|
||||
};
|
||||
var capaform = mist.convertBuildOptions(capa,saveas.params);
|
||||
if (capaform[1].is("h4")) capaform.splice(1,1);
|
||||
|
||||
//find left over url params that are not covered by this connector's capabilities
|
||||
var custom_params = [];
|
||||
for (var i in params) {
|
||||
var p = params[i].split("=");
|
||||
var name = p[0];
|
||||
if (!(name in push_parameters)) {
|
||||
if (!(name in full_list_of_push_parameters)) {
|
||||
custom_params.push(name+(p.length > 1 ? "="+p.slice(1).join("=") : ""));
|
||||
}
|
||||
}
|
||||
|
@ -6115,46 +6122,10 @@ var UI = {
|
|||
$additional_params.append(UI.buildUI(capaform));
|
||||
}
|
||||
},
|
||||
$autopush,
|
||||
$additional_params
|
||||
$additional_params,
|
||||
$autopush
|
||||
];
|
||||
|
||||
|
||||
|
||||
/*
|
||||
if (other == "auto") { //options only for automatic pushes
|
||||
|
||||
build.push($("<h4>").text("Optional parameters"),{
|
||||
type: "unix",
|
||||
label: "Schedule time",
|
||||
min: 0,
|
||||
help: "The time where the push will become active. The default is to start immediately.",
|
||||
pointer: {
|
||||
main: saveas,
|
||||
index: "scheduletime"
|
||||
}
|
||||
},{
|
||||
type: "unix",
|
||||
label: "Recording start time",
|
||||
min: 0,
|
||||
help: "Where in the media buffer the recording will start. Defaults to the most recently received keyframe.<br>Only makes sense for live streams.",
|
||||
pointer: {
|
||||
main: saveas,
|
||||
index: "recstartunix"
|
||||
}
|
||||
},{
|
||||
type: "unix",
|
||||
label: "Complete time",
|
||||
min: 0,
|
||||
help: "The time where the push will stop. Defaults to never stop automatically.<br>Only makes sense for live streams.",
|
||||
pointer: {
|
||||
main: saveas,
|
||||
index: "completetime"
|
||||
}
|
||||
});
|
||||
|
||||
}*/
|
||||
|
||||
build.push({
|
||||
type: 'buttons',
|
||||
buttons: [{
|
||||
|
@ -6192,7 +6163,7 @@ var UI = {
|
|||
delete params[i];
|
||||
}
|
||||
else if (!(i in full_list_of_push_parameters)) {
|
||||
//remove any params that are not supported by this protocol (they will have been duplicatec to saveas.custom_url_parameters if the user wanted to keep them)
|
||||
//remove any params that are not supported by this protocol (they will have been duplicated to saveas.custom_url_parameters if the user wanted to keep them)
|
||||
delete params[i];
|
||||
}
|
||||
}
|
||||
|
@ -6214,28 +6185,14 @@ var UI = {
|
|||
params["recstartunix"] = saveas.scheduletime;
|
||||
}
|
||||
if (Object.keys(params).length || (saveas.custom_url_params && saveas.custom_url_params.length)) {
|
||||
var append = "?";
|
||||
var curparams = saveas.target.split("?");
|
||||
if (curparams.length > 1) {
|
||||
append = "&";
|
||||
curparams = curparams[curparams.length-1];
|
||||
curparams = curparams.split("&");
|
||||
for (var i in curparams) {
|
||||
var key = curparams[i].split("=")[0];
|
||||
if (key in params) { delete params[key]; }
|
||||
}
|
||||
var str = [];
|
||||
for (var i in params) { //the MistServer settings as entered in "Optional parameters"
|
||||
str.push(i+"="+params[i]);
|
||||
}
|
||||
if (Object.keys(params).length || (saveas.custom_url_params && saveas.custom_url_params.length)) {
|
||||
var str = [];
|
||||
for (var i in params) {
|
||||
str.push(i+"="+params[i]);
|
||||
}
|
||||
for (var i in saveas.custom_url_params) {
|
||||
str.push(saveas.custom_url_params[i]);
|
||||
}
|
||||
append += str.join("&");
|
||||
saveas.target += append;
|
||||
for (var i in saveas.custom_url_params) { //the MistServer settings custom url parameters
|
||||
str.push(saveas.custom_url_params[i]);
|
||||
}
|
||||
saveas.target += "?"+str.join("&");
|
||||
}
|
||||
delete saveas.params; //these are now part of the target url and we don't need them separately
|
||||
delete saveas.custom_url_params;
|
||||
|
@ -10310,10 +10267,13 @@ var mist = {
|
|||
break;
|
||||
}
|
||||
case 'group': {
|
||||
var $cont = $("<div>").addClass("itemgroup");
|
||||
var children = mist.convertBuildOptions({
|
||||
optional: ele.options
|
||||
},saveas);
|
||||
children = children.slice(1); //remove h4 "Optional parameters"
|
||||
var $summary = $("<ul>").addClass("summary");
|
||||
children.unshift($summary);
|
||||
if ("help" in ele) {
|
||||
children.unshift(
|
||||
$("<span>").addClass("description").text(ele.help)
|
||||
|
@ -10321,10 +10281,51 @@ var mist = {
|
|||
}
|
||||
if ("name" in ele) {
|
||||
children.unshift(
|
||||
$("<b>").text(ele.name)
|
||||
$("<b>").text(ele.name).click(function(){
|
||||
$cont.toggleClass("expanded")
|
||||
}).attr("title","Click to show / hide these options")
|
||||
);
|
||||
}
|
||||
return $("<div>").addClass("itemsettings").append(UI.buildUI(children));
|
||||
if (ele.expand || (!(ele.expand === false) && Object.keys(ele.options).length < 2)) {
|
||||
//do not collapse fields on creation if expand: true is passed
|
||||
//always collapse fields if expand: false is passed
|
||||
//otherwise, collapse if group contains 2 fields or more
|
||||
$cont.addClass("expanded");
|
||||
}
|
||||
return $cont.change(function(){
|
||||
$summary.html("");
|
||||
$(this).find(".isSetting, input[type=\"hidden\"].isSetting").each(function(){
|
||||
var val = $(this).getval();
|
||||
if (val == "") { return; }
|
||||
var opts = $(this).data('opts');
|
||||
if (val != opts['default']) {
|
||||
var label = opts["label"]+": ";
|
||||
switch (opts.type) {
|
||||
case "select": {
|
||||
val = opts.select.filter(function(v){ if (v[0] == val) return true; return false; })[0][1]; break;
|
||||
}
|
||||
case "unix": {
|
||||
val = UI.format.dateTime(val); break;
|
||||
}
|
||||
case "checkbox": {
|
||||
val = "";
|
||||
label = label.slice(0,-2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$summary.append(
|
||||
$("<li>").addClass("setting").append(
|
||||
$("<span>").addClass("label").text(label)
|
||||
).append(
|
||||
$("<span>").text(val)
|
||||
).append(
|
||||
$("<span>").addClass("unit").text(typeof opts.unit == "string" ? opts["unit"] : "")
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
}).append(UI.buildUI(children)).trigger("change");
|
||||
|
||||
|
||||
}
|
||||
case 'bool': {
|
||||
|
|
|
@ -182,11 +182,14 @@ namespace Mist{
|
|||
seek(seekPos);
|
||||
}
|
||||
|
||||
static void addIntOpt(JSON::Value & pp, const std::string & param, const std::string & name, const std::string & help, size_t def = 0){
|
||||
static void addIntOpt(JSON::Value & pp, const std::string & param, const std::string & name, const std::string & help, size_t def = 0,const std::string unit = ""){
|
||||
pp[param]["name"] = name;
|
||||
pp[param]["help"] = help;
|
||||
pp[param]["type"] = "int";
|
||||
pp[param]["default"] = (uint64_t)def;
|
||||
if (unit != "") {
|
||||
pp[param]["unit"] = unit;
|
||||
}
|
||||
}
|
||||
|
||||
static void addStrOpt(JSON::Value & pp, const std::string & param, const std::string & name, const std::string & help, const std::string & def = ""){
|
||||
|
@ -200,16 +203,16 @@ namespace Mist{
|
|||
pp[param]["name"] = name;
|
||||
pp[param]["help"] = help;
|
||||
pp[param]["type"] = "select";
|
||||
pp[param]["select"][0u][0u] = 0;
|
||||
pp[param]["select"][0u][1u] = "False";
|
||||
pp[param]["select"][1u][0u] = 1;
|
||||
pp[param]["select"][1u][1u] = "True";
|
||||
pp[param]["select"][0u][0u] = "";
|
||||
pp[param]["select"][0u][1u] = def?"Default (true)":"Default (false)";
|
||||
pp[param]["select"][1u][0u] = 0;
|
||||
pp[param]["select"][1u][1u] = "False";
|
||||
pp[param]["select"][2u][0u] = 1;
|
||||
pp[param]["select"][2u][1u] = "True";
|
||||
pp[param]["type"] = "select";
|
||||
pp[param]["default"] = def?1:0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void OutTSSRT::init(Util::Config *cfg){
|
||||
Output::init(cfg);
|
||||
capa["name"] = "TSSRT";
|
||||
|
@ -266,61 +269,104 @@ namespace Mist{
|
|||
config->addStandardPushCapabilities(capa);
|
||||
JSON::Value & pp = capa["push_parameters"];
|
||||
|
||||
pp["mode"]["name"] = "Mode";
|
||||
pp["mode"]["help"] = "The connection mode. Can be listener, caller, or rendezvous. By default is listener if the host is missing from the URL, and is caller otherwise.";
|
||||
pp["mode"]["type"] = "select";
|
||||
pp["mode"]["select"][0u][0u] = "default";
|
||||
pp["mode"]["select"][0u][1u] = "Default";
|
||||
pp["mode"]["select"][1u][0u] = "listener";
|
||||
pp["mode"]["select"][1u][1u] = "Listener";
|
||||
pp["mode"]["select"][2u][0u] = "caller";
|
||||
pp["mode"]["select"][2u][1u] = "Caller";
|
||||
pp["mode"]["select"][3u][0u] = "rendezvous";
|
||||
pp["mode"]["select"][3u][1u] = "Rendezvous";
|
||||
pp["mode"]["type"] = "select";
|
||||
pp["srtopts_main"]["name"] = "Commonly used SRT options";
|
||||
pp["srtopts_main"]["help"] = "Control the SRT connection";
|
||||
pp["srtopts_main"]["type"] = "group";
|
||||
pp["srtopts_main"]["sort"] = "aaa";
|
||||
pp["srtopts_main"]["expand"] = true;
|
||||
|
||||
pp["transtype"]["name"] = "Transmission type";
|
||||
pp["transtype"]["help"] = "This should be set to live (the default) unless you know what you're doing.";
|
||||
pp["transtype"]["type"] = "select";
|
||||
pp["transtype"]["select"][0u][0u] = "";
|
||||
pp["transtype"]["select"][0u][1u] = "Live";
|
||||
pp["transtype"]["select"][1u][0u] = "file";
|
||||
pp["transtype"]["select"][1u][1u] = "File";
|
||||
pp["transtype"]["type"] = "select";
|
||||
addIntOpt(pp["srtopts_main"]["options"], "latency", "Latency", "Socket latency, in milliseconds.", 120,"ms");
|
||||
addStrOpt(pp["srtopts_main"]["options"], "streamid", "Stream ID", "Stream ID to transmit to the other side. MistServer uses this field for the stream name, but the field is entirely free-form and may contain anything.");
|
||||
addStrOpt(pp["srtopts_main"]["options"], "passphrase", "Encryption passphrase", "Enables encryption with the given passphrase.");
|
||||
|
||||
|
||||
pp["srtopts"]["name"] = "More SRT options";
|
||||
pp["srtopts"]["help"] = "Control the SRT connection";
|
||||
pp["srtopts"]["type"] = "group";
|
||||
pp["srtopts"]["sort"] = "ab";
|
||||
|
||||
pp["srtopts"]["options"]["mode"]["name"] = "Mode";
|
||||
pp["srtopts"]["options"]["mode"]["help"] = "The connection mode. Can be listener, caller, or rendezvous. By default is listener if the host is missing from the URL, and is caller otherwise.";
|
||||
pp["srtopts"]["options"]["mode"]["type"] = "select";
|
||||
pp["srtopts"]["options"]["mode"]["select"][0u][0u] = "";
|
||||
pp["srtopts"]["options"]["mode"]["select"][0u][1u] = "Default (listener)";
|
||||
pp["srtopts"]["options"]["mode"]["select"][1u][0u] = "listener";
|
||||
pp["srtopts"]["options"]["mode"]["select"][1u][1u] = "Listener";
|
||||
pp["srtopts"]["options"]["mode"]["select"][2u][0u] = "caller";
|
||||
pp["srtopts"]["options"]["mode"]["select"][2u][1u] = "Caller";
|
||||
pp["srtopts"]["options"]["mode"]["select"][3u][0u] = "rendezvous";
|
||||
pp["srtopts"]["options"]["mode"]["select"][3u][1u] = "Rendezvous";
|
||||
|
||||
pp["srtopts"]["options"]["transtype"]["name"] = "Transmission type";
|
||||
pp["srtopts"]["options"]["transtype"]["help"] = "This should be set to live (the default) unless you know what you're doing.";
|
||||
pp["srtopts"]["options"]["transtype"]["select"][0u][0u] = "";
|
||||
pp["srtopts"]["options"]["transtype"]["select"][0u][1u] = "Default (live)";
|
||||
pp["srtopts"]["options"]["transtype"]["select"][1u][0u] = "live";
|
||||
pp["srtopts"]["options"]["transtype"]["select"][1u][1u] = "Live";
|
||||
pp["srtopts"]["options"]["transtype"]["select"][2u][0u] = "file";
|
||||
pp["srtopts"]["options"]["transtype"]["select"][2u][1u] = "File";
|
||||
pp["srtopts"]["options"]["transtype"]["type"] = "select";
|
||||
|
||||
|
||||
//addStrOpt(pp, "adapter", "", "");
|
||||
//addIntOpt(pp, "timeout", "", "");
|
||||
//addIntOpt(pp, "port", "", "");
|
||||
addBoolOpt(pp, "tsbpd", "Timestamp-based Packet Delivery mode", "In this mode the packet's time is assigned at the sending time (or allowed to be predefined), transmitted in the packet's header, and then restored on the receiver side so that the time intervals between consecutive packets are preserved when delivering to the application.", true);
|
||||
addBoolOpt(pp, "linger", "Linger closed sockets", "Whether to keep closed sockets around for 180 seconds of linger time or not.", true);
|
||||
addIntOpt(pp, "maxbw", "Maximum send bandwidth", "Maximum send bandwidth in bytes per second, -1 for infinite, 0 for relative to input bandwidth.", -1);
|
||||
addIntOpt(pp, "pbkeylen", "Encryption key length", "May be 0 (auto), 16 (AES-128), 24 (AES-192) or 32 (AES-256).", 0);
|
||||
addStrOpt(pp, "passphrase", "Encryption passphrase", "Enables encryption with the given passphrase.");
|
||||
addIntOpt(pp, "mss", "Maximum Segment Size", "Maximum size for packets including all headers, in bytes. The default of 1500 is generally the maximum value you can use in most networks.", 1500);
|
||||
addIntOpt(pp, "fc", "Flight Flag Size", "Maximum packets that may be 'in flight' without being acknowledged.", 25600);
|
||||
addIntOpt(pp, "sndbuf", "Send Buffer Size", "Size of the send buffer, in bytes");
|
||||
addIntOpt(pp, "rcvbuf", "Receive Buffer Size", "Size of the receive buffer, in bytes");
|
||||
addIntOpt(pp, "ipttl", "TTL", "Time To Live for IPv4 connections or unicast hops for IPv6 connections. Defaults to system default.");
|
||||
addIntOpt(pp, "iptos", "Type of Service", "TOS for IPv4 connections or Traffic Class for IPv6 connections. Defaults to system default.");
|
||||
addIntOpt(pp, "inputbw", "Input bandwidth", "Estimated bandwidth of data to be sent. Default of 0 means automatic.");
|
||||
addIntOpt(pp, "oheadbw", "Recovery Bandwidth Overhead", "Percentage of bandwidth to use for recovery.", 25);
|
||||
addIntOpt(pp, "latency", "Latency", "Socket latency, in milliseconds.", 120);
|
||||
|
||||
addBoolOpt(pp["srtopts"]["options"], "tsbpd", "Timestamp-based Packet Delivery mode", "In this mode the packet's time is assigned at the sending time (or allowed to be predefined), transmitted in the packet's header, and then restored on the receiver side so that the time intervals between consecutive packets are preserved when delivering to the application.", true);
|
||||
|
||||
addBoolOpt(pp["srtopts"]["options"], "linger", "Linger closed sockets", "Whether to keep closed sockets around for 180 seconds of linger time or not.", true);
|
||||
addIntOpt(pp["srtopts"]["options"], "maxbw", "Maximum send bandwidth", "Maximum send bandwidth in bytes per second, -1 for infinite, 0 for relative to input bandwidth.", -1,"bytes/s");
|
||||
|
||||
|
||||
pp["srtopts"]["options"]["pbkeylen"]["name"] = "Encryption key length";
|
||||
pp["srtopts"]["options"]["pbkeylen"]["help"] = "The encryption key length. Default: auto.";
|
||||
pp["srtopts"]["options"]["pbkeylen"]["select"][0u][0u] = "";
|
||||
pp["srtopts"]["options"]["pbkeylen"]["select"][0u][1u] = "Default (auto)";
|
||||
pp["srtopts"]["options"]["pbkeylen"]["select"][1u][0u] = "0";
|
||||
pp["srtopts"]["options"]["pbkeylen"]["select"][1u][1u] = "Auto";
|
||||
pp["srtopts"]["options"]["pbkeylen"]["select"][2u][0u] = "16";
|
||||
pp["srtopts"]["options"]["pbkeylen"]["select"][2u][1u] = "AES-128";
|
||||
pp["srtopts"]["options"]["pbkeylen"]["select"][3u][0u] = "24";
|
||||
pp["srtopts"]["options"]["pbkeylen"]["select"][3u][1u] = "AES-192";
|
||||
pp["srtopts"]["options"]["pbkeylen"]["select"][4u][0u] = "32";
|
||||
pp["srtopts"]["options"]["pbkeylen"]["select"][4u][1u] = "AES-256";
|
||||
pp["srtopts"]["options"]["pbkeylen"]["default"] = "0";
|
||||
pp["srtopts"]["options"]["pbkeylen"]["type"] = "select";
|
||||
|
||||
|
||||
|
||||
addIntOpt(pp["srtopts"]["options"], "mss", "Maximum Segment Size", "Maximum size for packets including all headers, in bytes. The default of 1500 is generally the maximum value you can use in most networks.", 1500,"bytes");
|
||||
addIntOpt(pp["srtopts"]["options"], "fc", "Flight Flag Size", "Maximum packets that may be 'in flight' without being acknowledged.", 25600,"packets");
|
||||
addIntOpt(pp["srtopts"]["options"], "sndbuf", "Send Buffer Size", "Size of the send buffer, in bytes",0,"bytes");
|
||||
addIntOpt(pp["srtopts"]["options"], "rcvbuf", "Receive Buffer Size", "Size of the receive buffer, in bytes",0,"bytes");
|
||||
addIntOpt(pp["srtopts"]["options"], "ipttl", "TTL", "Time To Live for IPv4 connections or unicast hops for IPv6 connections. Defaults to system default.",0,"hops");
|
||||
addIntOpt(pp["srtopts"]["options"], "iptos", "Type of Service", "TOS for IPv4 connections or Traffic Class for IPv6 connections. Defaults to system default.");
|
||||
addIntOpt(pp["srtopts"]["options"], "inputbw", "Input bandwidth", "Estimated bandwidth of data to be sent. Default of 0 means automatic.",0,"bytes/s");
|
||||
addIntOpt(pp["srtopts"]["options"], "oheadbw", "Recovery Bandwidth Overhead", "Percentage of bandwidth to use for recovery.",25,"%");
|
||||
//addIntOpt(pp, "rcvlatency", "Receive Latency", "Latency in receive mode, in milliseconds", 120);
|
||||
//addIntOpt(pp, "peerlatency", "", "");
|
||||
addBoolOpt(pp, "tlpktdrop", "Too-late Packet Drop", "Skips packets that cannot (sending) or have not (receiving) been delivered in time", true);
|
||||
addIntOpt(pp, "snddropdelay", "Send Drop Delay", "Extra delay before Too-late packet drop on sender side is triggered, in milliseconds.");
|
||||
addBoolOpt(pp, "nakreport", "Repeat loss reports", "When enabled, repeats loss reports every time the retransmission timeout has expired.", true);
|
||||
addIntOpt(pp, "conntimeo", "Connect timeout", "Milliseconds to wait before timing out a connection attempt for caller and rendezvous modes.", 3000);
|
||||
addIntOpt(pp, "lossmaxttl", "Reorder Tolerance", "Maximum amount of packets that may be out of order, or 0 to disable this mechanism.");
|
||||
addIntOpt(pp, "minversion", "Minimum SRT version", "Minimum SRT version to require the other side of the connection to support.");
|
||||
addStrOpt(pp, "streamid", "Stream ID", "Stream ID to transmit to the other side. MistServer uses this field for the stream name, but the field is entirely free-form and may contain anything.");
|
||||
addStrOpt(pp, "congestion", "Congestion controller", "May be set to 'live' or 'file'", "live");
|
||||
addBoolOpt(pp, "messageapi", "Message API", "When true, uses the default Message API. When false, uses the Stream API", true);
|
||||
addBoolOpt(pp["srtopts"]["options"], "tlpktdrop", "Too-late Packet Drop", "Skips packets that cannot (sending) or have not (receiving) been delivered in time", true);
|
||||
addIntOpt(pp["srtopts"]["options"], "snddropdelay", "Send Drop Delay", "Extra delay before Too-late packet drop on sender side is triggered, in milliseconds.",0,"ms");
|
||||
addBoolOpt(pp["srtopts"]["options"], "nakreport", "Repeat loss reports", "When enabled, repeats loss reports every time the retransmission timeout has expired.", true);
|
||||
addIntOpt(pp["srtopts"]["options"], "conntimeo", "Connect timeout", "Milliseconds to wait before timing out a connection attempt for caller and rendezvous modes.", 3000,"ms");
|
||||
addIntOpt(pp["srtopts"]["options"], "lossmaxttl", "Reorder Tolerance", "Maximum amount of packets that may be out of order, or 0 to disable this mechanism.",0,"packets");
|
||||
addIntOpt(pp["srtopts"]["options"], "minversion", "Minimum SRT version", "Minimum SRT version to require the other side of the connection to support.");
|
||||
|
||||
addStrOpt(pp["srtopts"]["options"], "congestion", "Congestion controller", "May be set to 'live' or 'file'", "live");
|
||||
pp["srtopts"]["options"]["congestion"]["select"][0u][0u] = "";
|
||||
pp["srtopts"]["options"]["congestion"]["select"][0u][1u] = "Default (live)";
|
||||
pp["srtopts"]["options"]["congestion"]["select"][1u][0u] = "live";
|
||||
pp["srtopts"]["options"]["congestion"]["select"][1u][1u] = "Live";
|
||||
pp["srtopts"]["options"]["congestion"]["select"][2u][0u] = "file";
|
||||
pp["srtopts"]["options"]["congestion"]["select"][2u][1u] = "File";
|
||||
pp["srtopts"]["options"]["congestion"]["type"] = "select";
|
||||
|
||||
addBoolOpt(pp["srtopts"]["options"], "messageapi", "Message API", "When true, uses the default Message API. When false, uses the Stream API", true);
|
||||
//addIntOpt(pp, "kmrefreshrate", "", "");
|
||||
//addIntOpt(pp, "kmreannounce", "", "");
|
||||
addBoolOpt(pp, "enforcedencryption", "Enforced Encryption", "If enabled, enforces that both sides either set no passphrase, or set the same passphrase. When disabled, falls back to no passphrase if the passphrases do not match.", true);
|
||||
addIntOpt(pp, "peeridletimeo", "Peer Idle Timeout", "Time to wait, in milliseconds, before the connection is considered broken if the peer does not respond.", 5000);
|
||||
addStrOpt(pp, "packetfilter", "Packet Filter", "Sets the SRT packet filter string, see SRT library documentation for details.");
|
||||
addBoolOpt(pp["srtopts"]["options"], "enforcedencryption", "Enforced Encryption", "If enabled, enforces that both sides either set no passphrase, or set the same passphrase. When disabled, falls back to no passphrase if the passphrases do not match.", true);
|
||||
addIntOpt(pp["srtopts"]["options"], "peeridletimeo", "Peer Idle Timeout", "Time to wait, in milliseconds, before the connection is considered broken if the peer does not respond.", 5000,"ms");
|
||||
addStrOpt(pp["srtopts"]["options"], "packetfilter", "Packet Filter", "Sets the SRT packet filter string, see SRT library documentation for details.");
|
||||
|
||||
JSON::Value opt;
|
||||
opt["arg"] = "string";
|
||||
|
|
Loading…
Add table
Reference in a new issue