LSP/embed: fix for + in filenames in folder streams

This commit is contained in:
cat 2016-07-21 11:35:00 +02:00 committed by Thulinma
parent e1fac6248e
commit b7c37ba60d
3 changed files with 18 additions and 10 deletions

View file

@ -2824,7 +2824,7 @@ var UI = {
var embedoptions = {autoplay: true}; var embedoptions = {autoplay: true};
function embedhtml(opts) { function embedhtml(opts) {
var open = ['div']; var open = ['div'];
var inner = "\n"+' <script src="'+embedbase+'embed_'+other+'.js"><'+'/script>'+"\n"; //don't leave the closing script tag complete var inner = "\n"+' <script src="'+embedbase+'embed_'+encodeURIComponent(other)+'.js"><'+'/script>'+"\n"; //don't leave the closing script tag complete
if (!opts.autoplay) { if (!opts.autoplay) {
open.push('data-noautoplay'); open.push('data-noautoplay');
} }
@ -2844,17 +2844,17 @@ var UI = {
{ {
label: 'Embedable script', label: 'Embedable script',
type: 'str', type: 'str',
value: embedbase+'embed_'+other+'.js', value: embedbase+'embed_'+encodeURIComponent(other)+'.js',
readonly: true readonly: true
},{ },{
label: 'Stream info script', label: 'Stream info script',
type: 'str', type: 'str',
value: embedbase+'info_'+other+'.js', value: embedbase+'info_'+encodeURIComponent(other)+'.js',
readonly: true readonly: true
},{ },{
label: 'Autodetect player', label: 'Autodetect player',
type: 'str', type: 'str',
value: embedbase+other+'.html', value: embedbase+encodeURIComponent(other)+'.html',
readonly: true, readonly: true,
qrcode: true qrcode: true
},$('<h3>').text('Embed code'),{ },$('<h3>').text('Embed code'),{
@ -3027,7 +3027,7 @@ var UI = {
// jQuery doesn't work -> use DOM magic // jQuery doesn't work -> use DOM magic
var script = document.createElement('script'); var script = document.createElement('script');
script.src = embedbase+'embed_'+other+'.js'; script.src = embedbase+'embed_'+encodeURIComponent(other)+'.js';
script.onerror = function(){ script.onerror = function(){
$c.html('Error loading "'+script.src+'".<br>').append( $c.html('Error loading "'+script.src+'".<br>').append(
$('<button>').text('Try again').click(function(){ $('<button>').text('Try again').click(function(){

View file

@ -14,7 +14,7 @@
var embedtype = $('input[name=force]').val(); var embedtype = $('input[name=force]').val();
var info = document.createElement('script'); var info = document.createElement('script');
info.src = 'http://'+(window.location.hostname == '' ? 'localhost' : window.location.hostname)+':8080/info_'+streamName+'.js?video=0'; info.src = 'http://'+(window.location.hostname == '' ? 'localhost' : window.location.hostname)+':8080/info_'+encodeURIComponent(streamName)+'.js';
document.getElementById('embedcontainer').appendChild(info); document.getElementById('embedcontainer').appendChild(info);
info.onload = function(){ info.onload = function(){
if (embedtype == '') { if (embedtype == '') {
@ -45,4 +45,4 @@
<div id=embedcontainer style="width: 100%; height: 35em;" data-forcesupportcheck data-autoplay> <div id=embedcontainer style="width: 100%; height: 35em;" data-forcesupportcheck data-autoplay>
</div> </div>
</body> </body>
</html> </html>

View file

@ -189,7 +189,7 @@ function mistembed(streamname) {
break; break;
case 'html5': case 'html5':
container.innerHTML += '<video width="' + videowidth + '" height="' + videoheight + '" src="' + encodeURI(src.url) + '" controls="controls" '+(autoplay ? 'autoplay="autoplay"' : '')+'><strong>No HTML5 video support</strong></video>'; container.innerHTML += '<video width="' + videowidth + '" height="' + videoheight + '" src="' + src.url + '" controls="controls" '+(autoplay ? 'autoplay="autoplay"' : '')+'><strong>No HTML5 video support</strong></video>';
break; break;
case 'rtsp': case 'rtsp':
@ -264,11 +264,19 @@ function mistembed(streamname) {
if(video.error) { if(video.error) {
// there was an error; display it // there was an error; display it
container.innerHTML = ['<strong>Error: ', video.error, '</strong>'].join(''); if (video.on_error){
container.innerHTML = video.on_error;
}else{
container.innerHTML = ['<strong>Error: ', video.error, '</strong>'].join('');
}
} }
else if ((typeof video.source == 'undefined') || (video.source.length < 1)) { else if ((typeof video.source == 'undefined') || (video.source.length < 1)) {
// no stream sources // no stream sources
container.innerHTML = '<strong>Error: no protocols found</strong>'; if (video.on_error){
container.innerHTML = video.on_error;
}else{
container.innerHTML = '<strong>Error: no active source or compatible protocols for this stream</strong>';
}
} }
else { else {
// no error, and sources found. Check the video types and output the best // no error, and sources found. Check the video types and output the best