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,33 +3508,31 @@ 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 || [];
|
||||
items = await apiClient.getLocalTrailers(apiClient.getCurrentUserId(), item.Id);
|
||||
}
|
||||
|
||||
if (!remoteTrailers.length) {
|
||||
return Promise.reject();
|
||||
}
|
||||
|
||||
return this.play({
|
||||
items: remoteTrailers.map(function (t) {
|
||||
return {
|
||||
Name: t.Name || (item.Name + ' Trailer'),
|
||||
Url: t.Url,
|
||||
MediaType: 'Video',
|
||||
Type: 'Trailer',
|
||||
ServerId: apiClient.serverId()
|
||||
};
|
||||
})
|
||||
if (!items || !items.length) {
|
||||
items = (item.RemoteTrailers || []).map((t) => {
|
||||
return {
|
||||
Name: t.Name || (item.Name + ' Trailer'),
|
||||
Url: t.Url,
|
||||
MediaType: 'Video',
|
||||
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