1
0
Fork 0
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:
Luke Pulverenti 2013-04-30 15:13:06 -04:00
parent 760e6a6f0c
commit 2f38234372
4 changed files with 39 additions and 5 deletions

View file

@ -49,7 +49,8 @@
}
.userDataCell {
width: 140px;
width: 130px;
text-align: right;
}
.tabletColumn {

View file

@ -120,6 +120,10 @@
}
}
.playFlyout a {
font-size: 14px;
}
.detailPageName {
margin: 0 0 .1em;
}

View file

@ -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 () {

View file

@ -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'
@ -369,7 +398,7 @@
return mediaType == "Audio";
};
self.playLast = function(itemId) {
self.playLast = function (itemId) {
};