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

Playback continuation and AudioBook playlist/queue now working as desired after minor modifications to playbackmanager.js

This commit is contained in:
Samson50 2024-05-08 00:51:19 -04:00
parent 29b7071be7
commit 3226eef67e
3 changed files with 9 additions and 9 deletions

View file

@ -1969,6 +1969,9 @@ class PlaybackManager {
if (promise) { if (promise) {
return promise.then(function (result) { return promise.then(function (result) {
if (firstItem.Type === 'AudioBook') {
options.startIndex = result.StartIndex;
}
return result ? result.Items : items; return result ? result.Items : items;
}); });
} else { } else {
@ -1982,9 +1985,7 @@ class PlaybackManager {
// This is the exposed function called to manage item media playback // This is the exposed function called to manage item media playback
self.play = function (options) { self.play = function (options) {
normalizePlayOptions(options); normalizePlayOptions(options);
console.debug('playing');
// I think this class *is* the "localpalyer", others are plugins or chromecast
if (self._currentPlayer) { if (self._currentPlayer) {
if (options.enableRemotePlayers === false && !self._currentPlayer.isLocalPlayer) { if (options.enableRemotePlayers === false && !self._currentPlayer.isLocalPlayer) {
return Promise.reject(); return Promise.reject();
@ -1995,13 +1996,11 @@ class PlaybackManager {
} }
} }
console.debug('using "localplayer" (*wink*)');
if (options.fullscreen) { if (options.fullscreen) {
loading.show(); loading.show();
} }
if (options.items) { if (options.items) {
console.debug('playing from options.items');
return translateItemsForPlayback(options.items, options) return translateItemsForPlayback(options.items, options)
.then((items) => getAdditionalParts(items)) .then((items) => getAdditionalParts(items))
.then(function (allItems) { .then(function (allItems) {
@ -2009,7 +2008,6 @@ class PlaybackManager {
return playWithIntros(flattened, options); return playWithIntros(flattened, options);
}); });
} else { } else {
console.debug('calling getItemsForPlayback');
if (!options.serverId) { if (!options.serverId) {
throw new Error('serverId required!'); throw new Error('serverId required!');
} }
@ -2238,6 +2236,10 @@ class PlaybackManager {
} }
function playInternal(item, playOptions, onPlaybackStartedFn, prevSource) { function playInternal(item, playOptions, onPlaybackStartedFn, prevSource) {
if (item.Type === 'AudioBookFile') {
playOptions.startPositionTicks = item.UserData.PlaybackPositionTicks;
}
if (item.IsPlaceHolder) { if (item.IsPlaceHolder) {
loading.hide(); loading.hide();
showPlaybackInfoErrorMessage(self, 'PlaybackErrorPlaceHolder'); showPlaybackInfoErrorMessage(self, 'PlaybackErrorPlaceHolder');
@ -2499,6 +2501,7 @@ class PlaybackManager {
} }
return Promise.all([promise, player.getDeviceProfile(item)]).then(function (responses) { return Promise.all([promise, player.getDeviceProfile(item)]).then(function (responses) {
// TODO: Why does this skip the first entry?
const deviceProfile = responses[1]; const deviceProfile = responses[1];
const apiClient = ServerConnections.getApiClient(item.ServerId); const apiClient = ServerConnections.getApiClient(item.ServerId);

View file

@ -693,9 +693,7 @@ class AppRouter {
return url; return url;
} }
if (item.CollectionType == CollectionType.Books) { if (item.CollectionType == CollectionType.Books) {
let urlForList = '#/books.html?topParentId=' + item.Id; return '#/books.html?parentId=' + id + '&serverId=' + serverId + '&topParentId=' + item.Id;
return urlForList;
} }
} }

View file

@ -185,7 +185,6 @@ function getItems(instance, params, item, sortBy, startIndex, limit) {
instance.queryRecursive = false; instance.queryRecursive = false;
if (!item) { if (!item) {
// console.log("I dont think this is right");
instance.queryRecursive = true; instance.queryRecursive = true;
return apiClient['getItems'](apiClient.getCurrentUserId(), modifyQueryWithFilters(instance, { return apiClient['getItems'](apiClient.getCurrentUserId(), modifyQueryWithFilters(instance, {