mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
add js local asset manager
This commit is contained in:
parent
2eff956685
commit
6e6bf85030
6 changed files with 92 additions and 3 deletions
|
@ -488,8 +488,54 @@
|
|||
|
||||
};
|
||||
|
||||
function getPlaybackInfoFromLocalMediaSource(itemId, deviceProfile, startPosition, mediaSource) {
|
||||
|
||||
mediaSource.SupportsDirectPlay = true;
|
||||
|
||||
return {
|
||||
|
||||
MediaSources: [mediaSource],
|
||||
|
||||
// Just dummy this up
|
||||
PlaySessionId: new Date().getTime().toString()
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
self.getPlaybackInfo = function (itemId, deviceProfile, startPosition, mediaSource, audioStreamIndex, subtitleStreamIndex, liveStreamId) {
|
||||
|
||||
var deferred = DeferredBuilder.Deferred();
|
||||
|
||||
Dashboard.loadLocalAssetManager().done(function () {
|
||||
|
||||
var serverInfo = ApiClient.serverInfo().Id;
|
||||
|
||||
if (serverInfo.Id) {
|
||||
var localMediaSource = window.LocalAssetManager.getLocalMediaSource(serverInfo.Id, itemId);
|
||||
|
||||
// Use the local media source if a specific one wasn't requested, or the smae one was requested
|
||||
if (localMediaSource && (!mediaSource || mediaSource.Id == localMediaSource.Id)) {
|
||||
|
||||
var playbackInfo = getPlaybackInfoFromLocalMediaSource(itemId, deviceProfile, startPosition, localMediaSource);
|
||||
|
||||
deferred.resolveWith(null, [playbackInfo]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
self.getPlaybackInfoInternal(itemId, deviceProfile, startPosition, mediaSource, audioStreamIndex, subtitleStreamIndex, liveStreamId).done(function (result) {
|
||||
deferred.resolveWith(null, [result]);
|
||||
}).fail(function () {
|
||||
deferred.reject();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
return deferred.promise();
|
||||
}
|
||||
|
||||
self.getPlaybackInfoInternal = function (itemId, deviceProfile, startPosition, mediaSource, audioStreamIndex, subtitleStreamIndex, liveStreamId) {
|
||||
|
||||
var postData = {
|
||||
DeviceProfile: deviceProfile
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue