LSP: preview height.. force

This commit is contained in:
cat 2016-06-14 14:56:54 +02:00 committed by Thulinma
parent 680f9acfa8
commit 589dcd21ea
4 changed files with 15 additions and 11 deletions

View file

@ -754,10 +754,13 @@ body:not(.helpme) .input_container .ih_balloon {
.video_container { .video_container {
max-width: 90%; max-width: 90%;
max-width: calc(100vw - 22em); max-width: calc(100vw - 22em);
max-height: 90vh; height: 90vh;
max-height: calc(100vh - 15em); height: calc(100vh - 15em);
overflow: hidden; overflow: hidden;
} }
.mistvideo {
height: 100%;
}
video { video {
min-width: auto; min-width: auto;
} }

View file

@ -106,12 +106,12 @@ a.urlappend!=""&&b.push('data-urlappend="'+a.urlappend.replace(/\"/g,'\\"')+'"')
readonly:!0,classes:["embed_code"]},$("<h4>").text("Embed code options").css("margin-top",0),{label:"Autoplay",type:"checkbox",value:!0,pointer:{main:y,index:"autoplay"},"function":function(){y.autoplay=$(this).getval();$(".embed_code").setval(K(y))}},{label:"Force protocol",type:"select",select:[["","Automatic"]],pointer:{main:y,index:"protocol"},classes:["embed_code_forceprotocol"],"function":function(){y.forceprotocol=$(this).getval();$(".embed_code").setval(K(y))}},{label:"Video URL addition", readonly:!0,classes:["embed_code"]},$("<h4>").text("Embed code options").css("margin-top",0),{label:"Autoplay",type:"checkbox",value:!0,pointer:{main:y,index:"autoplay"},"function":function(){y.autoplay=$(this).getval();$(".embed_code").setval(K(y))}},{label:"Force protocol",type:"select",select:[["","Automatic"]],pointer:{main:y,index:"protocol"},classes:["embed_code_forceprotocol"],"function":function(){y.forceprotocol=$(this).getval();$(".embed_code").setval(K(y))}},{label:"Video URL addition",
type:"str",pointer:{main:y,index:"urlappend"},help:"The embed script will append this string to the video url, useful for sending through params.",classes:["embed_code_forceprotocol"],"function":function(){y.urlappend=$(this).getval();$(".embed_code").setval(K(y))}},$("<h3>").text("Protocol stream urls"),X]));l=$("<span>").append($("<h3>").text("Meta information")).hide();D["Meta information"]=l;var O=$("<span>");l.append(O);d.append(l);l=$("<span>").hide();D.Preview=l;d.append(l);var L=$("<div>").css({"float":"left", type:"str",pointer:{main:y,index:"urlappend"},help:"The embed script will append this string to the video url, useful for sending through params.",classes:["embed_code_forceprotocol"],"function":function(){y.urlappend=$(this).getval();$(".embed_code").setval(K(y))}},$("<h3>").text("Protocol stream urls"),X]));l=$("<span>").append($("<h3>").text("Meta information")).hide();D["Meta information"]=l;var O=$("<span>");l.append(O);d.append(l);l=$("<span>").hide();D.Preview=l;d.append(l);var L=$("<div>").css({"float":"left",
"margin-right":"1em",width:"100%"}),t=$("<div>").addClass("video_container").attr("data-forcesupportcheck","");L.html(t);var Y=$("<div>").css("float","left");l.append(L).append(Y);mist.stored.get().autoplay||t.attr("data-noautoplay","");var M=function(){t.text("Loading..");L.children(".input_container").remove();var a=document.createElement("script");a.src=H+"embed_"+c+".js";a.onerror=function(){t.html('Error loading "'+a.src+'".<br>').append($("<button>").text("Try again").click(function(){M()}))}; "margin-right":"1em",width:"100%"}),t=$("<div>").addClass("video_container").attr("data-forcesupportcheck","");L.html(t);var Y=$("<div>").css("float","left");l.append(L).append(Y);mist.stored.get().autoplay||t.attr("data-noautoplay","");var M=function(){t.text("Loading..");L.children(".input_container").remove();var a=document.createElement("script");a.src=H+"embed_"+c+".js";a.onerror=function(){t.html('Error loading "'+a.src+'".<br>').append($("<button>").text("Try again").click(function(){M()}))};
a.onload=function(){if(typeof mistvideo[c].error!="undefined")t.html(mistvideo[c].error+"<br>").append($("<button>").text("Try again").click(function(){M()}));else{var a=mistvideo[c],b=UI.buildUI([{label:"Protocol stream url",type:"str",readonly:true,value:a.embedded?a.embedded.url:"",qrcode:true},{label:"Autoplay (from now on)",type:"checkbox",value:mist.stored.get().autoplay,"function":function(){mist.stored.set("autoplay",$(this).getval()?1:0)}}]);b.find(".help_container").remove();L.append(b); a.onload=function(){if(typeof mistvideo[c].error!="undefined")t.height("5em").html(mistvideo[c].error+"<br>").append($("<button>").text("Try again").click(function(){M()}));else{var a=mistvideo[c],b=UI.buildUI([{label:"Protocol stream url",type:"str",readonly:true,value:a.embedded?a.embedded.url:"",qrcode:true},{label:"Autoplay (from now on)",type:"checkbox",value:mist.stored.get().autoplay,"function":function(){mist.stored.set("autoplay",$(this).getval()?1:0)}}]);t.height(Math.min(a.height,t.height()));
var d=$("<table>").css("font-size","0.9em").html($("<thead>").html($("<tr>").html($("<th>")).append($("<th>").text("Type")).append($("<th>").text("Priority")).append($("<th>").text("Simul. tracks")).append($("<th>").html("Your browser<br>support"))));Y.html(d);b=$("<tbody>");d.append(b);var d=$(".embed_code_forceprotocol"),e=[];d.find(".clear").remove();for(var g in a.source){var f=a.source[g],h=f.type.split("/"),i=h[0];i.length<6&&(i=i.toUpperCase());switch(h.length){case 1:break;case 2:i=UI.format.capital(h[0])+ b.find(".help_container").remove();L.append(b);var d=$("<table>").css("font-size","0.9em").html($("<thead>").html($("<tr>").html($("<th>")).append($("<th>").text("Type")).append($("<th>").text("Priority")).append($("<th>").text("Simul. tracks")).append($("<th>").html("Your browser<br>support"))));Y.html(d);b=$("<tbody>");d.append(b);var d=$(".embed_code_forceprotocol"),e=[];d.find(".clear").remove();for(var g in a.source){var f=a.source[g],h=f.type.split("/"),i=h[0];i.length<6&&(i=i.toUpperCase());
" v"+h[1];if(h[0]=="flash")switch(h[1]){case "7":i="Progressive ("+i+")";break;case "10":i="RTMP ("+i+")";break;case "11":i="HDS ("+i+")"}break;case 3:switch(h[2]){case "vnd.apple.mpegurl":i=i+" HLS";break;case "vnd.ms-ss":i=i+" Smooth";break;case "mp2t":i=i+" TS";break;default:h[2].length<6&&(h[2]=h[2].toUpperCase());i=i+(" "+h[2]);h[1]!="video"&&(i=i+(" ("+h[1]+")"))}break;default:i=f.type}i=UI.format.capital(i);d.append($("<option>").text(i).val(f.type).addClass("clear"));e.push({label:i,type:"str", switch(h.length){case 1:break;case 2:i=UI.format.capital(h[0])+" v"+h[1];if(h[0]=="flash")switch(h[1]){case "7":i="Progressive ("+i+")";break;case "10":i="RTMP ("+i+")";break;case "11":i="HDS ("+i+")"}break;case 3:switch(h[2]){case "vnd.apple.mpegurl":i=i+" HLS";break;case "vnd.ms-ss":i=i+" Smooth";break;case "mp2t":i=i+" TS";break;default:h[2].length<6&&(h[2]=h[2].toUpperCase());i=i+(" "+h[2]);h[1]!="video"&&(i=i+(" ("+h[1]+")"))}break;default:i=f.type}i=UI.format.capital(i);d.append($("<option>").text(i).val(f.type).addClass("clear"));
value:f.url,readonly:true,qrcode:true});h=$("<tr>");b.append(h);h.html($("<td>").html($("<input>").attr("type","radio").attr("name","protocolforce").change(function(){t.attr("data-forcetype",$(this).val()).html("Loading embed..");M()}).val(f.type))).append($("<td>").text(i)).append($("<td>").text(f.priority)).append($("<td>").text(f.simul_tracks+"/"+f.total_matches)).append($("<td>").text(f.browser_support?"yes":"no"));if(a.embedded&&a.embedded.type==f.type){h.css("outline","1px solid rgba(0,0,0,0.5)"); e.push({label:i,type:"str",value:f.url,readonly:true,qrcode:true});h=$("<tr>");b.append(h);h.html($("<td>").html($("<input>").attr("type","radio").attr("name","protocolforce").change(function(){t.attr("data-forcetype",$(this).val()).html("Loading embed..");M()}).val(f.type))).append($("<td>").text(i)).append($("<td>").text(f.priority)).append($("<td>").text(f.simul_tracks+"/"+f.total_matches)).append($("<td>").text(f.browser_support?"yes":"no"));if(a.embedded&&a.embedded.type==f.type){h.css("outline",
h.find("input[type=radio]").prop("checked",true)}}X.html(UI.buildUI(e));var j;if(c in mistvideo)j=mistvideo[c].meta;if(j){a=[];a.push({label:"Type",type:"span",value:j.live?"Live":"Pre-recorded (VoD)"});"format"in j&&a.push({label:"Format",type:"span",value:j.format});j.live&&a.push({label:"Buffer window",type:"span",value:UI.format.addUnit(j.buffer_window,"ms")});b={vheader:"Audio",labels:["Codec","Duration","Peak bitrate","Channels","Samplerate"],content:[]};g={vheader:"Video",labels:["Codec","Duration", "1px solid rgba(0,0,0,0.5)");h.find("input[type=radio]").prop("checked",true)}}X.html(UI.buildUI(e));var j;if(c in mistvideo)j=mistvideo[c].meta;if(j){a=[];a.push({label:"Type",type:"span",value:j.live?"Live":"Pre-recorded (VoD)"});"format"in j&&a.push({label:"Format",type:"span",value:j.format});j.live&&a.push({label:"Buffer window",type:"span",value:UI.format.addUnit(j.buffer_window,"ms")});b={vheader:"Audio",labels:["Codec","Duration","Peak bitrate","Channels","Samplerate"],content:[]};g={vheader:"Video",
"Peak bitrate","Size","Framerate"],content:[]};d=Object.keys(j.tracks);d.sort(function(a,b){a=a.split("_").pop();b=b.split("_").pop();return a-b});for(var l in d){e=d[l];f=j.tracks[e];switch(f.type){case "audio":b.content.push({header:"Track "+e.split("_").pop(),body:[f.codec,UI.format.duration((f.lastms-f.firstms)/1E3)+"<br><span class=description>"+UI.format.duration(f.firstms/1E3)+" to "+UI.format.duration(f.lastms/1E3)+"</span>",UI.format.bytes(f.bps,1),f.channels,UI.format.addUnit(UI.format.number(f.rate), labels:["Codec","Duration","Peak bitrate","Size","Framerate"],content:[]};d=Object.keys(j.tracks);d.sort(function(a,b){a=a.split("_").pop();b=b.split("_").pop();return a-b});for(var l in d){e=d[l];f=j.tracks[e];switch(f.type){case "audio":b.content.push({header:"Track "+e.split("_").pop(),body:[f.codec,UI.format.duration((f.lastms-f.firstms)/1E3)+"<br><span class=description>"+UI.format.duration(f.firstms/1E3)+" to "+UI.format.duration(f.lastms/1E3)+"</span>",UI.format.bytes(f.bps,1),f.channels,UI.format.addUnit(UI.format.number(f.rate),
"Hz")]});break;case "video":g.content.push({header:"Track "+e.split("_").pop(),body:[f.codec,UI.format.duration((f.lastms-f.firstms)/1E3)+"<br><span class=description>"+UI.format.duration(f.firstms/1E3)+" to "+UI.format.duration(f.lastms/1E3)+"</span>",UI.format.bytes(f.bps,1),UI.format.addUnit(f.width,"x ")+UI.format.addUnit(f.height,"px"),UI.format.addUnit(UI.format.number(f.fpks/1E3),"fps")]})}}j=UI.buildVheaderTable(b).css("width","auto");l=UI.buildVheaderTable(g).css("width","auto");a.push($("<span>").text("Tracks:")); "Hz")]});break;case "video":g.content.push({header:"Track "+e.split("_").pop(),body:[f.codec,UI.format.duration((f.lastms-f.firstms)/1E3)+"<br><span class=description>"+UI.format.duration(f.firstms/1E3)+" to "+UI.format.duration(f.lastms/1E3)+"</span>",UI.format.bytes(f.bps,1),UI.format.addUnit(f.width,"x ")+UI.format.addUnit(f.height,"px"),UI.format.addUnit(UI.format.number(f.fpks/1E3),"fps")]})}}j=UI.buildVheaderTable(b).css("width","auto");l=UI.buildVheaderTable(g).css("width","auto");a.push($("<span>").text("Tracks:"));
a.push($("<div>").css({display:"flex","flex-flow":"row wrap","justify-content":"center","font-size":"0.9em"}).append(j).append(l));O.html(UI.buildUI(a))}else O.html("No meta information available.")}};t.html("")[0].appendChild(a)};M();var P=UI.elements.secondary_menu;P.html("").append($("<a>").addClass("button").text("Choose stream").click(function(){UI.navto("Preview")})).append($("<span>").addClass("separator"));l=["Preview","Embed urls","Meta information"];w=l[0];for(q in l)r=$("<a>").addClass("button").text(l[q]).click(function(){P.find(".active").removeClass("active"); a.push($("<div>").css({display:"flex","flex-flow":"row wrap","justify-content":"center","font-size":"0.9em"}).append(j).append(l));O.html(UI.buildUI(a))}else O.html("No meta information available.")}};t.html("")[0].appendChild(a)};M();var P=UI.elements.secondary_menu;P.html("").append($("<a>").addClass("button").text("Choose stream").click(function(){UI.navto("Preview")})).append($("<span>").addClass("separator"));l=["Preview","Embed urls","Meta information"];w=l[0];for(q in l)r=$("<a>").addClass("button").text(l[q]).click(function(){P.find(".active").removeClass("active");
$(this).addClass("active");for(q in D)D[q].hide();D[$(this).text()].show()}),P.append(r),l[q]==w&&(r.addClass("active"),D[w].show());break;case "Push":t=$("<div>").text("Loading..");d.append(t);mist.send(function(a){function b(a,c){var d=$("<span>");a.length>=4&&a[2]!=a[3]?d.append($("<span>").text(a[2])).append($("<span>").html("&#187").addClass("unit").css("margin","0 0.5em")).append($("<span>").text(a[3])):d.append($("<span>").text(a[2]));return $("<tr>").append($("<td>").text(a[1])).append($("<td>").append(d.children())).append($("<td>").append($("<button>").text(c== $(this).addClass("active");for(q in D)D[q].hide();D[$(this).text()].show()}),P.append(r),l[q]==w&&(r.addClass("active"),D[w].show());break;case "Push":t=$("<div>").text("Loading..");d.append(t);mist.send(function(a){function b(a,c){var d=$("<span>");a.length>=4&&a[2]!=a[3]?d.append($("<span>").text(a[2])).append($("<span>").html("&#187").addClass("unit").css("margin","0 0.5em")).append($("<span>").text(a[3])):d.append($("<span>").text(a[2]));return $("<tr>").append($("<td>").text(a[1])).append($("<td>").append(d.children())).append($("<td>").append($("<button>").text(c==

View file

@ -3026,7 +3026,7 @@ var UI = {
}; };
script.onload = function(){ script.onload = function(){
if (typeof mistvideo[other].error != 'undefined') { if (typeof mistvideo[other].error != 'undefined') {
$c.html(mistvideo[other].error+'<br>').append( $c.height('5em').html(mistvideo[other].error+'<br>').append(
$('<button>').text('Try again').click(function(){ $('<button>').text('Try again').click(function(){
loadVideo(); loadVideo();
}) })
@ -3049,6 +3049,7 @@ var UI = {
mist.stored.set('autoplay',($(this).getval() ? 1 : 0)); mist.stored.set('autoplay',($(this).getval() ? 1 : 0));
} }
}]); }]);
$c.height(Math.min(vid.height,$c.height())); //set height to height of video element
$url.find('.help_container').remove(); $url.find('.help_container').remove();
$video.append($url); $video.append($url);

View file

@ -141,8 +141,8 @@ function mistembed(streamname) {
var ratio; var ratio;
// get the container's width/height // get the container's width/height
var containerwidth = parseInt(container.scrollWidth, 10); var containerwidth = parseInt(container.clientWidth, 10);
var containerheight = parseInt(container.scrollHeight, 10); var containerheight = parseInt(container.clientHeight, 10);
if(videowidth > containerwidth && containerwidth > 0) { if(videowidth > containerwidth && containerwidth > 0) {
ratio = videowidth / containerwidth; ratio = videowidth / containerwidth;