1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update stream generation

This commit is contained in:
Luke Pulverenti 2015-03-29 00:56:39 -04:00
parent c2800786fa
commit bf21a282da
2 changed files with 37 additions and 16 deletions

View file

@ -803,26 +803,24 @@
if (mediaSource) {
self.currentMediaSource = mediaSource;
self.currentItem = item;
if (mediaSource.RequiresOpening1) {
if (item.MediaType === "Video") {
ApiClient.ajax({
url: ApiClient.getUrl('MediaSources/Open', {
OpenToken: mediaSource.OpenToken
}),
type: 'POST',
dataType: "json"
self.currentMediaElement = self.playVideo(deviceProfile, result, item, self.currentMediaSource, startPosition);
self.currentDurationTicks = self.currentMediaSource.RunTimeTicks;
}).done(function (openLiveStreamResult) {
self.updateNowPlayingInfo(item);
mediaSource = openLiveStreamResult;
playInternalPostMediaSourceSelection(item, mediaSource, startPosition, callback);
});
} else if (item.MediaType === "Audio") {
self.currentMediaElement = playAudio(item, self.currentMediaSource, startPosition);
self.currentDurationTicks = self.currentMediaSource.RunTimeTicks;
} else {
playInternalPostMediaSourceSelection(item, mediaSource, startPosition, callback);
}
if (callback) {
callback();
}
} else {
showPlaybackInfoErrorMessage('NoCompatibleStream');
}
@ -831,6 +829,29 @@
});
};
function playInternalPostMediaSourceSelection(item, mediaSource, startPosition, callback) {
self.currentMediaSource = mediaSource;
self.currentItem = item;
if (item.MediaType === "Video") {
self.currentMediaElement = self.playVideo(item, self.currentMediaSource, startPosition);
self.currentDurationTicks = self.currentMediaSource.RunTimeTicks;
self.updateNowPlayingInfo(item);
} else if (item.MediaType === "Audio") {
self.currentMediaElement = playAudio(item, self.currentMediaSource, startPosition);
self.currentDurationTicks = self.currentMediaSource.RunTimeTicks;
}
if (callback) {
callback();
}
}
function validatePlaybackInfoResult(result) {
if (result.ErrorCode) {