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
|
@ -282,7 +282,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@media all and (max-width: 1440px) {
|
||||
@media all and (max-width: 1280px) {
|
||||
|
||||
/* They can use the left menu */
|
||||
.dashboardEntryHeaderButton {
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
|
|
@ -1448,6 +1448,25 @@ var Dashboard = {
|
|||
return deferred.promise();
|
||||
},
|
||||
|
||||
loadLocalAssetManager: function () {
|
||||
|
||||
var deferred = DeferredBuilder.Deferred();
|
||||
|
||||
var file = 'thirdparty/apiclient/localassetmanager';
|
||||
|
||||
if (AppInfo.isNativeApp && $.browser.android) {
|
||||
file = 'thirdparty/cordova/android/localassetmanager';
|
||||
}
|
||||
|
||||
require([
|
||||
file
|
||||
], function () {
|
||||
|
||||
deferred.resolve();
|
||||
});
|
||||
return deferred.promise();
|
||||
},
|
||||
|
||||
ready: function (fn) {
|
||||
|
||||
if (Dashboard.initPromiseDone) {
|
||||
|
|
|
@ -123,8 +123,10 @@
|
|||
textLines.push(' ');
|
||||
}
|
||||
|
||||
html += '<div class="cardText" style="text-align:right; position:absolute; bottom:5px; right: 5px;">';
|
||||
html += '<button class="btnJobMenu" type="button" data-inline="true" data-iconpos="notext" data-icon="ellipsis-v" style="margin: 0 0 0;"></button>';
|
||||
html += '<div class="cardText" style="text-align:right; position:absolute; bottom:5px; right: 5px;font-size:20px;">';
|
||||
html += '<button type="button" data-role="none" class="btnJobMenu imageButton">';
|
||||
html += '<i class="material-icons">more_vert</i>';
|
||||
html += '</button>';
|
||||
html += "</div>";
|
||||
|
||||
for (var i = 0, length = textLines.length; i < length; i++) {
|
||||
|
|
11
dashboard-ui/thirdparty/apiclient/localassetmanager.js
vendored
Normal file
11
dashboard-ui/thirdparty/apiclient/localassetmanager.js
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
(function () {
|
||||
|
||||
function getLocalMediaSource(serverId, itemId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
window.LocalAssetManager = {
|
||||
getLocalMediaSource: getLocalMediaSource
|
||||
};
|
||||
|
||||
})();
|
11
dashboard-ui/thirdparty/cordova/android/localassetmanager.js
vendored
Normal file
11
dashboard-ui/thirdparty/cordova/android/localassetmanager.js
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
(function () {
|
||||
|
||||
function getLocalMediaSource(serverId, itemId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
window.LocalAssetManager = {
|
||||
getLocalMediaSource: getLocalMediaSource
|
||||
};
|
||||
|
||||
})();
|
Loading…
Add table
Add a link
Reference in a new issue