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

update live stream bitrates

This commit is contained in:
Luke Pulverenti 2017-01-26 01:26:58 -05:00
parent 7d9fcc3e4f
commit 5c4eca9008

View file

@ -1678,7 +1678,6 @@ define(['events', 'datetime', 'appSettings', 'pluginManager', 'userSettings', 'g
loading.hide(); loading.hide();
onPlaybackStartedFn(); onPlaybackStartedFn();
onPlaybackStarted(player, streamInfo); onPlaybackStarted(player, streamInfo);
return Promise.resolve();
}); });
}); });
} }
@ -1701,7 +1700,6 @@ define(['events', 'datetime', 'appSettings', 'pluginManager', 'userSettings', 'g
loading.hide(); loading.hide();
onPlaybackStartedFn(); onPlaybackStartedFn();
onPlaybackStarted(player, streamInfo, mediaSource); onPlaybackStarted(player, streamInfo, mediaSource);
return Promise.resolve();
}); });
}); });
}); });
@ -1996,7 +1994,7 @@ define(['events', 'datetime', 'appSettings', 'pluginManager', 'userSettings', 'g
if (mediaSource.RequiresOpening) { if (mediaSource.RequiresOpening) {
return getLiveStream(apiClient, item.Id, playbackInfoResult.PlaySessionId, deviceProfile, startPosition, mediaSource, null, null).then(function (openLiveStreamResult) { return getLiveStream(apiClient, item.Id, playbackInfoResult.PlaySessionId, deviceProfile, maxBitrate, startPosition, mediaSource, null, null).then(function (openLiveStreamResult) {
return supportsDirectPlay(apiClient, openLiveStreamResult.MediaSource).then(function (result) { return supportsDirectPlay(apiClient, openLiveStreamResult.MediaSource).then(function (result) {
@ -2084,7 +2082,7 @@ define(['events', 'datetime', 'appSettings', 'pluginManager', 'userSettings', 'g
}); });
} }
function getLiveStream(apiClient, itemId, playSessionId, deviceProfile, startPosition, mediaSource, audioStreamIndex, subtitleStreamIndex) { function getLiveStream(apiClient, itemId, playSessionId, deviceProfile, maxBitrate, startPosition, mediaSource, audioStreamIndex, subtitleStreamIndex) {
var postData = { var postData = {
DeviceProfile: deviceProfile, DeviceProfile: deviceProfile,
@ -2098,6 +2096,9 @@ define(['events', 'datetime', 'appSettings', 'pluginManager', 'userSettings', 'g
PlaySessionId: playSessionId PlaySessionId: playSessionId
}; };
if (maxBitrate) {
query.MaxStreamingBitrate = maxBitrate;
}
if (audioStreamIndex != null) { if (audioStreamIndex != null) {
query.AudioStreamIndex = audioStreamIndex; query.AudioStreamIndex = audioStreamIndex;
} }
@ -2122,38 +2123,34 @@ define(['events', 'datetime', 'appSettings', 'pluginManager', 'userSettings', 'g
var isServerAddress = url.toLowerCase().replace('https:', 'http').indexOf(apiClient.serverAddress().toLowerCase().replace('https:', 'http').substring(0, 14)) === 0; var isServerAddress = url.toLowerCase().replace('https:', 'http').indexOf(apiClient.serverAddress().toLowerCase().replace('https:', 'http').substring(0, 14)) === 0;
if (isServerAddress) { if (isServerAddress) {
return Promise.resolve(); return Promise.resolve(true);
} }
if (mediaSource.IsRemote) { if (mediaSource.IsRemote) {
return Promise.resolve(); return Promise.resolve(true);
} }
return Promise.reject(); return Promise.resolve(false);
} }
function supportsDirectPlay(apiClient, mediaSource) { function supportsDirectPlay(apiClient, mediaSource) {
return new Promise(function (resolve, reject) { if (mediaSource.SupportsDirectPlay) {
if (mediaSource.SupportsDirectPlay) { if (mediaSource.Protocol === 'Http' && !mediaSource.RequiredHttpHeaders.length) {
if (mediaSource.Protocol === 'Http' && !mediaSource.RequiredHttpHeaders.length) { // If this is the only way it can be played, then allow it
if (!mediaSource.SupportsDirectStream && !mediaSource.SupportsTranscoding) {
// If this is the only way it can be played, then allow it return Promise.resolve(true);
if (!mediaSource.SupportsDirectStream && !mediaSource.SupportsTranscoding) {
resolve(true);
}
else {
isHostReachable(mediaSource, apiClient).then(function () {
resolve(true);
}, function () {
resolve(false);
});
}
} }
else {
return isHostReachable(mediaSource, apiClient);
}
}
else if (mediaSource.Protocol === 'File') { else if (mediaSource.Protocol === 'File') {
return new Promise(function (resolve, reject) {
// Determine if the file can be accessed directly // Determine if the file can be accessed directly
require(['filesystem'], function (filesystem) { require(['filesystem'], function (filesystem) {
@ -2169,12 +2166,11 @@ define(['events', 'datetime', 'appSettings', 'pluginManager', 'userSettings', 'g
}); });
}); });
} });
} }
else { }
resolve(false);
} return Promise.resolve(false);
});
} }
function validatePlaybackInfoResult(result) { function validatePlaybackInfoResult(result) {