mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
stream audio statically when possible
This commit is contained in:
parent
760e6a6f0c
commit
2f38234372
4 changed files with 39 additions and 5 deletions
|
@ -49,7 +49,8 @@
|
|||
}
|
||||
|
||||
.userDataCell {
|
||||
width: 140px;
|
||||
width: 130px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.tabletColumn {
|
||||
|
|
|
@ -120,6 +120,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
.playFlyout a {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.detailPageName {
|
||||
margin: 0 0 .1em;
|
||||
}
|
||||
|
|
|
@ -237,7 +237,7 @@
|
|||
|
||||
html += '<tr>';
|
||||
|
||||
html += '<td><button data-icon="play" data-mini="true" data-iconpos="notext" onclick="LibraryBrowser.showPlayMenu(this, \'' + item.Id + '\', \'Audio\');">Options</button></td>';
|
||||
html += '<td><button type="button" data-role="none" style="border:0;padding:0;margin:0;background:none;" onclick="LibraryBrowser.showPlayMenu(this, \'' + item.Id + '\', \'Audio\');"><img src="css/images/media/playCircle.png" style="height: 16px;"></button></td>';
|
||||
|
||||
var num = item.IndexNumber;
|
||||
|
||||
|
@ -297,7 +297,7 @@
|
|||
|
||||
var html = '<div data-role="popup" class="playFlyout" style="max-width:300px;" data-corners="false" data-theme="c" data-history="false">';
|
||||
|
||||
html += '<ul data-role="listview" style="min-width: 150px;" data-theme="c">';
|
||||
html += '<ul data-role="listview" style="min-width: 150px;font-size:14px;" data-theme="c">';
|
||||
html += '<li data-role="list-divider" data-theme="a">Play Menu</li>';
|
||||
|
||||
html += '<li><a href="#" onclick="MediaPlayer.playById(\'' + itemId + '\');LibraryBrowser.closePlayMenu();">Play</a></li>';
|
||||
|
@ -321,7 +321,7 @@
|
|||
|
||||
$(this).off("popupafterclose").remove();
|
||||
|
||||
}).parents(".ui-popup-container").css("margin-left", 110).css("margin-top", 50);
|
||||
}).parents(".ui-popup-container").css("margin-left", 100).css("margin-top", 35);
|
||||
},
|
||||
|
||||
closePlayMenu: function () {
|
||||
|
|
|
@ -8,6 +8,15 @@
|
|||
var currentMediaElement;
|
||||
var currentProgressInterval;
|
||||
|
||||
function endsWith(text, pattern) {
|
||||
|
||||
text = text.toLowerCase();
|
||||
pattern = pattern.toLowerCase();
|
||||
|
||||
var d = text.length - pattern.length;
|
||||
return d >= 0 && text.lastIndexOf(pattern) === d;
|
||||
}
|
||||
|
||||
function playAudio(item, params) {
|
||||
|
||||
var volume = localStorage.getItem("volume") || 0.5;
|
||||
|
@ -31,6 +40,26 @@
|
|||
audioCodec: 'Vorbis'
|
||||
}));
|
||||
|
||||
var mediaStreams = item.MediaStreams || [];
|
||||
|
||||
for (var i = 0, length = mediaStreams.length; i < length; i++) {
|
||||
|
||||
var stream = mediaStreams[i];
|
||||
|
||||
if (stream.Type == "Audio") {
|
||||
|
||||
// Stream statically when possible
|
||||
if (endsWith(item.Path, ".aac") && stream.BitRate <= 256000) {
|
||||
aacUrl += "&static=true";
|
||||
}
|
||||
else if (endsWith(item.Path, ".mp3") && stream.BitRate <= 256000) {
|
||||
mp3Url += "&static=true";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* ffmpeg always says the ogg stream is corrupt after conversion
|
||||
var oggUrl = ApiClient.getUrl('Audio/' + item.Id + '/stream.oga', $.extend({}, baseParams, {
|
||||
audioCodec: 'Vorbis'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue