mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 11:28:23 -07:00
Fix trailer playback when no local trailers are available
This commit is contained in:
parent
cc6611a98a
commit
e455ecbb75
@ -3499,7 +3499,7 @@ class PlaybackManager {
|
||||
this.seek(ticks, player);
|
||||
}
|
||||
|
||||
playTrailers(item) {
|
||||
async playTrailers(item) {
|
||||
const player = this._currentPlayer;
|
||||
|
||||
if (player && player.playTrailers) {
|
||||
@ -3508,23 +3508,14 @@ class PlaybackManager {
|
||||
|
||||
const apiClient = ServerConnections.getApiClient(item.ServerId);
|
||||
|
||||
const instance = this;
|
||||
let items;
|
||||
|
||||
if (item.LocalTrailerCount) {
|
||||
return apiClient.getLocalTrailers(apiClient.getCurrentUserId(), item.Id).then(function (result) {
|
||||
return instance.play({
|
||||
items: result
|
||||
});
|
||||
});
|
||||
} else {
|
||||
const remoteTrailers = item.RemoteTrailers || [];
|
||||
|
||||
if (!remoteTrailers.length) {
|
||||
return Promise.reject();
|
||||
items = await apiClient.getLocalTrailers(apiClient.getCurrentUserId(), item.Id);
|
||||
}
|
||||
|
||||
return this.play({
|
||||
items: remoteTrailers.map(function (t) {
|
||||
if (!items || !items.length) {
|
||||
items = (item.RemoteTrailers || []).map((t) => {
|
||||
return {
|
||||
Name: t.Name || (item.Name + ' Trailer'),
|
||||
Url: t.Url,
|
||||
@ -3532,9 +3523,16 @@ class PlaybackManager {
|
||||
Type: 'Trailer',
|
||||
ServerId: apiClient.serverId()
|
||||
};
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
if (items.length) {
|
||||
return this.play({
|
||||
items
|
||||
});
|
||||
}
|
||||
|
||||
return Promise.reject();
|
||||
}
|
||||
|
||||
getSubtitleUrl(textStream, serverId) {
|
||||
|
Loading…
Reference in New Issue
Block a user