update stream closing

This commit is contained in:
Luke Pulverenti 2015-03-23 13:19:21 -04:00
parent aab737aea3
commit 8830ee7c30
2 changed files with 12 additions and 10 deletions

View File

@ -1007,7 +1007,7 @@
}
};
self.playVideo = function (item, mediaSource, startPosition) {
self.playVideo = function (playbackInfo, item, mediaSource, startPosition) {
var mediaStreams = mediaSource.MediaStreams || [];
@ -1027,7 +1027,8 @@
deviceId: ApiClient.deviceId(),
Static: false,
mediaSourceId: mediaSource.Id,
api_key: ApiClient.accessToken()
api_key: ApiClient.accessToken(),
StreamId: playbackInfo.StreamId
};
if (selectedSubtitleStream && (!self.supportsSubtitleStreamExternally(selectedSubtitleStream) || !self.supportsTextTracks())) {
@ -1334,7 +1335,7 @@
length = self.playlist.length,
requiresNativeControls = !self.canAutoPlayVideo(),
controls = $(requiresNativeControls ? '.videoAdvancedControls' : '.videoControls');
if (length < 2) {
$('.videoTrackControl').hide();
return;

View File

@ -173,10 +173,10 @@
if (finalParams.isStatic) {
currentSrc = currentSrc.replace('.webm', '.mp4').replace('.m3u8', '.mp4');
currentSrc = replaceQueryString(currentSrc, 'StreamId', '');
currentSrc = replaceQueryString(currentSrc, 'ClientTime', '');
} else {
currentSrc = currentSrc.replace('.mp4', transcodingExtension).replace('.m4v', transcodingExtension).replace('.mkv', transcodingExtension).replace('.webm', transcodingExtension);
currentSrc = replaceQueryString(currentSrc, 'StreamId', new Date().getTime());
currentSrc = replaceQueryString(currentSrc, 'ClientTime', new Date().getTime());
}
currentSrc = replaceQueryString(currentSrc, 'AudioBitrate', finalParams.audioBitrate);
@ -607,14 +607,14 @@
if (item.MediaType === "Video") {
self.currentMediaElement = self.playVideo(item, self.currentMediaSource, startPosition);
self.currentMediaElement = self.playVideo(result, 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.currentMediaElement = playAudio(result, item, self.currentMediaSource, startPosition);
self.currentDurationTicks = self.currentMediaSource.RunTimeTicks;
}
@ -1402,7 +1402,7 @@
var supportsAac = document.createElement('audio').canPlayType('audio/aac').replace(/no/, '');
function playAudio(item, mediaSource, startPositionTicks) {
function playAudio(playbackInfo, item, mediaSource, startPositionTicks) {
startPositionTicks = startPositionTicks || 0;
@ -1412,7 +1412,8 @@
StartTimeTicks: startPositionTicks,
mediaSourceId: mediaSource.Id,
deviceId: ApiClient.deviceId(),
api_key: ApiClient.accessToken()
api_key: ApiClient.accessToken(),
StreamId: playbackInfo.StreamId
};
var sourceContainer = (mediaSource.Container || '').toLowerCase();
@ -1427,7 +1428,7 @@
var seekParam = startPositionTicks ? '#t=' + (startPositionTicks / 10000000) : '';
audioUrl += "&static=true" + seekParam;
} else {
audioUrl += "&StreamId=" + new Date().getTime();
audioUrl += "&ClientTime=" + new Date().getTime();
}
self.startTimeTicksOffset = isStatic ? 0 : startPositionTicks;