1
0
Fork 0
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:
Luke Pulverenti 2015-06-03 01:30:14 -04:00
parent 2eff956685
commit 6e6bf85030
6 changed files with 92 additions and 3 deletions

View file

@ -282,7 +282,7 @@
}
}
@media all and (max-width: 1440px) {
@media all and (max-width: 1280px) {
/* They can use the left menu */
.dashboardEntryHeaderButton {

View file

@ -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
};

View file

@ -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) {

View file

@ -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++) {

View file

@ -0,0 +1,11 @@
(function () {
function getLocalMediaSource(serverId, itemId) {
return null;
}
window.LocalAssetManager = {
getLocalMediaSource: getLocalMediaSource
};
})();

View file

@ -0,0 +1,11 @@
(function () {
function getLocalMediaSource(serverId, itemId) {
return null;
}
window.LocalAssetManager = {
getLocalMediaSource: getLocalMediaSource
};
})();