mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
fd0c1ec8ae
3 changed files with 36 additions and 13 deletions
|
@ -626,7 +626,7 @@
|
||||||
return stream.Type == "Video";
|
return stream.Type == "Video";
|
||||||
})[0];
|
})[0];
|
||||||
|
|
||||||
var bitrateSetting = parseInt(localStorage.getItem('preferredVideoBitrate') || '') || 1500000;
|
var bitrateSetting = self.getBitrateSetting();
|
||||||
|
|
||||||
var maxAllowedWidth = Math.max(screen.height, screen.width);
|
var maxAllowedWidth = Math.max(screen.height, screen.width);
|
||||||
|
|
||||||
|
|
|
@ -400,11 +400,36 @@
|
||||||
currentPlaylistIndex = 0;
|
currentPlaylistIndex = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
function getOptimalMediaVersion(versions) {
|
self.getBitrateSetting = function() {
|
||||||
|
return parseInt(localStorage.getItem('preferredVideoBitrate') || '') || 1500000;
|
||||||
|
};
|
||||||
|
|
||||||
// TODO: Implement
|
function getOptimalMediaVersion(mediaType, versions) {
|
||||||
|
|
||||||
return versions[0];
|
var optimalVersion;
|
||||||
|
|
||||||
|
if (mediaType == 'Video') {
|
||||||
|
|
||||||
|
var bitrateSetting = self.getBitrateSetting();
|
||||||
|
|
||||||
|
var maxAllowedWidth = Math.max(screen.height, screen.width);
|
||||||
|
|
||||||
|
optimalVersion = versions.filter(function (v) {
|
||||||
|
|
||||||
|
var videoStream = v.MediaStreams.filter(function (s) {
|
||||||
|
return s.Type == 'Video';
|
||||||
|
})[0];
|
||||||
|
|
||||||
|
var audioStream = v.MediaStreams.filter(function (s) {
|
||||||
|
return s.Type == 'Audio';
|
||||||
|
})[0];
|
||||||
|
|
||||||
|
return self.canPlayVideoDirect(v, videoStream, audioStream, null, maxAllowedWidth, bitrateSetting);
|
||||||
|
|
||||||
|
})[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return optimalVersion || versions[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
self.playInternal = function (item, startPosition, user) {
|
self.playInternal = function (item, startPosition, user) {
|
||||||
|
@ -424,7 +449,7 @@
|
||||||
if (item.MediaType === "Video") {
|
if (item.MediaType === "Video") {
|
||||||
|
|
||||||
currentItem = item;
|
currentItem = item;
|
||||||
currentMediaVersion = getOptimalMediaVersion(item.MediaVersions);
|
currentMediaVersion = getOptimalMediaVersion(item.MediaType, item.MediaVersions);
|
||||||
|
|
||||||
videoPlayer(self, item, currentMediaVersion, startPosition, user);
|
videoPlayer(self, item, currentMediaVersion, startPosition, user);
|
||||||
mediaElement = self.initVideoPlayer();
|
mediaElement = self.initVideoPlayer();
|
||||||
|
@ -435,7 +460,7 @@
|
||||||
} else if (item.MediaType === "Audio") {
|
} else if (item.MediaType === "Audio") {
|
||||||
|
|
||||||
currentItem = item;
|
currentItem = item;
|
||||||
currentMediaVersion = getOptimalMediaVersion(item.MediaVersions);
|
currentMediaVersion = getOptimalMediaVersion(item.MediaType, item.MediaVersions);
|
||||||
|
|
||||||
mediaElement = playAudio(item, currentMediaVersion, startPosition);
|
mediaElement = playAudio(item, currentMediaVersion, startPosition);
|
||||||
mediaControls.show();
|
mediaControls.show();
|
||||||
|
@ -1031,11 +1056,11 @@
|
||||||
if (stream.Type == "Audio") {
|
if (stream.Type == "Audio") {
|
||||||
|
|
||||||
// Stream statically when possible
|
// Stream statically when possible
|
||||||
if (endsWith(item.Path, ".aac") && stream.BitRate <= 256000) {
|
if (endsWith(mediaVersion.Path, ".aac") && stream.BitRate <= 256000) {
|
||||||
aacUrl += "&static=true" + seekParam;
|
aacUrl += "&static=true" + seekParam;
|
||||||
isStatic = true;
|
isStatic = true;
|
||||||
}
|
}
|
||||||
else if (endsWith(item.Path, ".mp3") && stream.BitRate <= 256000) {
|
else if (endsWith(mediaVersion.Path, ".mp3") && stream.BitRate <= 256000) {
|
||||||
mp3Url += "&static=true" + seekParam;
|
mp3Url += "&static=true" + seekParam;
|
||||||
isStatic = true;
|
isStatic = true;
|
||||||
}
|
}
|
||||||
|
@ -1175,7 +1200,7 @@
|
||||||
return (trunc(titles[0], 30) + "<br />" + trunc(titles[1], 30)).replace("---", " ");
|
return (trunc(titles[0], 30) + "<br />" + trunc(titles[1], 30)).replace("---", " ");
|
||||||
};
|
};
|
||||||
|
|
||||||
var getItemFields = "MediaStreams,Chapters,Path";
|
var getItemFields = "MediaVersions";
|
||||||
}
|
}
|
||||||
|
|
||||||
window.MediaPlayer = new mediaPlayer();
|
window.MediaPlayer = new mediaPlayer();
|
||||||
|
|
|
@ -162,8 +162,6 @@ var Dashboard = {
|
||||||
|
|
||||||
updateSystemInfo: function (info) {
|
updateSystemInfo: function (info) {
|
||||||
|
|
||||||
var isFirstLoad = !Dashboard.lastSystemInfo;
|
|
||||||
|
|
||||||
Dashboard.lastSystemInfo = info;
|
Dashboard.lastSystemInfo = info;
|
||||||
Dashboard.ensureWebSocket(info);
|
Dashboard.ensureWebSocket(info);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue