LSP - bugfix "preview page messes u pfor files with MP3 codecs"
This commit is contained in:
parent
a52fd35a57
commit
988a12d86f
1 changed files with 21 additions and 12 deletions
33
lsp/main.js
33
lsp/main.js
|
@ -1346,14 +1346,14 @@ function buildstreamembed(streamName,embedbase) {
|
||||||
$embedcont.append(
|
$embedcont.append(
|
||||||
$('<p>').text('Preview:')
|
$('<p>').text('Preview:')
|
||||||
).append(
|
).append(
|
||||||
$('<div>').attr('id','preview-container').attr('data-forcesupportcheck',1)
|
$('<div>').attr('id','preview-container').attr('data-forcesupportcheck',1).text('Loading embed..')
|
||||||
);
|
);
|
||||||
|
|
||||||
// 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_'+streamName+'.js';
|
script.src = embedbase+'embed_'+streamName+'.js';
|
||||||
script.onerror = function(){
|
script.onerror = function(){
|
||||||
$('#preview-container').text('Failed to load embed script.');
|
$('#preview-container').text('Error loading "'+script.src+'".');
|
||||||
};
|
};
|
||||||
script.onload = function(){
|
script.onload = function(){
|
||||||
if (typeof mistvideo[streamName].error != 'undefined') {
|
if (typeof mistvideo[streamName].error != 'undefined') {
|
||||||
|
@ -1361,23 +1361,32 @@ function buildstreamembed(streamName,embedbase) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var priority = mistvideo[streamName].source;
|
var priority = mistvideo[streamName].source;
|
||||||
|
|
||||||
if (typeof priority != 'undefined') {
|
if (typeof priority != 'undefined') {
|
||||||
|
for (var i in priority) {
|
||||||
|
priority[i].index = i;
|
||||||
|
}
|
||||||
|
|
||||||
$radio = $('<input>').attr('type','radio').attr('name','forcetype').attr('title','The embed type that is being used.').change(function(){
|
$radio = $('<input>').attr('type','radio').attr('name','forcetype').attr('title','The embed type that is being used.').change(function(){
|
||||||
$('#preview-container').attr('data-forcetype',$(this).val()).html('');
|
$('#preview-container').attr('data-forcetype',$(this).data('source_object').index).html('Loading embed..');
|
||||||
$(this).closest('table').find('tr.outline').removeClass('outline');
|
$(this).closest('table').find('tr.outline').removeClass('outline');
|
||||||
$(this).closest('tr').addClass('outline');
|
$(this).closest('tr').addClass('outline');
|
||||||
$('#streamurl').val(mistvideo[streamName].source[$(this).val()].url)
|
|
||||||
|
$('#streamurl').val($(this).data('source_object').url)
|
||||||
|
|
||||||
var script = document.createElement('script');
|
var script = document.createElement('script');
|
||||||
script.src = embedbase+'embed_'+streamName+'.js';
|
script.src = embedbase+'embed_'+streamName+'.js';
|
||||||
script.onload = function(){
|
script.onload = function(){};
|
||||||
|
script.onerror = function (){
|
||||||
};
|
$('#preview-container').html('Error loading "'+script.src+'".');
|
||||||
document.getElementById('preview-container').appendChild( script );
|
}
|
||||||
|
$('#preview-container').html('')[0].appendChild( script );
|
||||||
});
|
});
|
||||||
|
|
||||||
priority.sort(function(a,b){
|
priority.sort(function(a,b){
|
||||||
return b.priority - a.priority;
|
return b.priority - a.priority;
|
||||||
});
|
});
|
||||||
|
|
||||||
var $table = $('<table>').html(
|
var $table = $('<table>').html(
|
||||||
$('<tr>').html(
|
$('<tr>').html(
|
||||||
$('<th>')
|
$('<th>')
|
||||||
|
@ -1441,7 +1450,7 @@ function buildstreamembed(streamName,embedbase) {
|
||||||
$table.append(
|
$table.append(
|
||||||
$('<tr>').html(
|
$('<tr>').html(
|
||||||
$('<td>').html(
|
$('<td>').html(
|
||||||
$radio.clone(true).attr('data-name',priority[i].type).val(i)
|
$radio.clone(true).attr('data-name',priority[i].type).data('source_object',priority[i])
|
||||||
)
|
)
|
||||||
).append(
|
).append(
|
||||||
$('<td>').text(humantype)
|
$('<td>').text(humantype)
|
||||||
|
@ -1463,9 +1472,9 @@ function buildstreamembed(streamName,embedbase) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
document.getElementById('preview-container').appendChild( script );
|
$('#preview-container').html('')[0].appendChild( script );
|
||||||
|
|
||||||
|
|
||||||
|
$streaminfo.html('Loading stream meta info..');
|
||||||
// stream info
|
// stream info
|
||||||
getData(function(returnedData){
|
getData(function(returnedData){
|
||||||
settings.settings.streams = returnedData.streams;
|
settings.settings.streams = returnedData.streams;
|
||||||
|
@ -1581,7 +1590,7 @@ function buildstreamembed(streamName,embedbase) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$streaminfo.append(
|
$streaminfo.html(
|
||||||
$('<p>').text('Track information')
|
$('<p>').text('Track information')
|
||||||
).append(
|
).append(
|
||||||
$('<div>').css({'display':'table','table-layout':'fixed','min-height':'300px'}).html(
|
$('<div>').css({'display':'table','table-layout':'fixed','min-height':'300px'}).html(
|
||||||
|
|
Loading…
Add table
Reference in a new issue