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

get channel media info at runtime

This commit is contained in:
Luke Pulverenti 2014-11-18 21:45:12 -05:00
parent b06fdda96d
commit 3f79032731
22 changed files with 164 additions and 79 deletions

View file

@ -543,35 +543,35 @@
self.stop();
}
var mediaElement;
if (item.MediaType === "Video") {
self.currentItem = item;
self.currentMediaSource = getOptimalMediaSource(item.MediaType, item.MediaSources);
ApiClient.getJSON(ApiClient.getUrl('Items/' + item.Id + '/MediaInfo', {
userId: Dashboard.getCurrentUserId()
})).done(function(result) {
self.currentItem = item;
self.currentMediaSource = getOptimalMediaSource(item.MediaType, result.MediaSources);
self.currentMediaElement = self.playVideo(item, self.currentMediaSource, startPosition);
self.currentDurationTicks = self.currentMediaSource.RunTimeTicks;
self.updateNowPlayingInfo(item);
});
mediaElement = self.playVideo(item, self.currentMediaSource, startPosition);
self.currentDurationTicks = self.currentMediaSource.RunTimeTicks;
} else if (item.MediaType === "Audio") {
self.currentItem = item;
self.currentMediaSource = getOptimalMediaSource(item.MediaType, item.MediaSources);
mediaElement = playAudio(item, self.currentMediaSource, startPosition);
self.currentMediaElement = playAudio(item, self.currentMediaSource, startPosition);
self.currentDurationTicks = self.currentMediaSource.RunTimeTicks;
} else {
throw new Error("Unrecognized media type");
}
self.currentMediaElement = mediaElement;
if (item.MediaType === "Video") {
self.updateNowPlayingInfo(item);
}
};
self.getNowPlayingNameHtml = function (playerState) {