mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update client sync
This commit is contained in:
parent
0db16cad5a
commit
8bf9a6f51e
12 changed files with 133 additions and 206 deletions
|
@ -104,40 +104,6 @@
|
|||
return profile;
|
||||
}
|
||||
|
||||
function validatePlaybackInfoResult(result) {
|
||||
|
||||
if (result.ErrorCode) {
|
||||
|
||||
MediaController.showPlaybackInfoErrorMessage(result.ErrorCode);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function getOptimalMediaSource(mediaType, versions) {
|
||||
|
||||
var optimalVersion = versions.filter(function (v) {
|
||||
|
||||
v.enableDirectPlay = MediaController.supportsDirectPlay(v);
|
||||
|
||||
return v.enableDirectPlay;
|
||||
|
||||
})[0];
|
||||
|
||||
if (!optimalVersion) {
|
||||
optimalVersion = versions.filter(function (v) {
|
||||
|
||||
return v.SupportsDirectStream;
|
||||
|
||||
})[0];
|
||||
}
|
||||
|
||||
return optimalVersion || versions.filter(function (s) {
|
||||
return s.SupportsTranscoding;
|
||||
})[0];
|
||||
}
|
||||
|
||||
var currentMediaSource;
|
||||
var currentItem;
|
||||
var basePlayerState;
|
||||
|
@ -146,37 +112,13 @@
|
|||
function getVideoStreamInfo(item) {
|
||||
|
||||
var deferred = $.Deferred();
|
||||
Dashboard.showModalLoadingMsg();
|
||||
|
||||
var deviceProfile = getDeviceProfile();
|
||||
var startPosition = 0;
|
||||
|
||||
MediaController.getPlaybackInfo(item.Id, deviceProfile, startPosition).done(function (playbackInfoResult) {
|
||||
|
||||
if (validatePlaybackInfoResult(playbackInfoResult)) {
|
||||
|
||||
var mediaSource = getOptimalMediaSource(item.MediaType, playbackInfoResult.MediaSources);
|
||||
|
||||
if (mediaSource) {
|
||||
|
||||
if (mediaSource.RequiresOpening) {
|
||||
|
||||
MediaController.getLiveStream(item.Id, playbackInfoResult.PlaySessionId, deviceProfile, startPosition, mediaSource, null, null).done(function (openLiveStreamResult) {
|
||||
|
||||
openLiveStreamResult.MediaSource.enableDirectPlay = MediaController.supportsDirectPlay(openLiveStreamResult.MediaSource);
|
||||
|
||||
playInternalPostMediaSourceSelection(item, openLiveStreamResult.MediaSource, startPosition, deferred);
|
||||
});
|
||||
|
||||
} else {
|
||||
playInternalPostMediaSourceSelection(item, mediaSource, startPosition, deferred);
|
||||
}
|
||||
} else {
|
||||
Dashboard.hideModalLoadingMsg();
|
||||
MediaController.showPlaybackInfoErrorMessage('NoCompatibleStream');
|
||||
}
|
||||
}
|
||||
MediaPlayer.tryStartPlayback(deviceProfile, item, startPosition, function (mediaSource) {
|
||||
|
||||
playInternalPostMediaSourceSelection(item, mediaSource, startPosition, deferred);
|
||||
});
|
||||
|
||||
return deferred.promise();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue