mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge pull request #3334 from jellyfin/fix-play-trailer
This commit is contained in:
commit
c037160453
1 changed files with 21 additions and 23 deletions
|
@ -3499,7 +3499,7 @@ class PlaybackManager {
|
||||||
this.seek(ticks, player);
|
this.seek(ticks, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
playTrailers(item) {
|
async playTrailers(item) {
|
||||||
const player = this._currentPlayer;
|
const player = this._currentPlayer;
|
||||||
|
|
||||||
if (player && player.playTrailers) {
|
if (player && player.playTrailers) {
|
||||||
|
@ -3508,23 +3508,14 @@ class PlaybackManager {
|
||||||
|
|
||||||
const apiClient = ServerConnections.getApiClient(item.ServerId);
|
const apiClient = ServerConnections.getApiClient(item.ServerId);
|
||||||
|
|
||||||
const instance = this;
|
let items;
|
||||||
|
|
||||||
if (item.LocalTrailerCount) {
|
if (item.LocalTrailerCount) {
|
||||||
return apiClient.getLocalTrailers(apiClient.getCurrentUserId(), item.Id).then(function (result) {
|
items = await apiClient.getLocalTrailers(apiClient.getCurrentUserId(), item.Id);
|
||||||
return instance.play({
|
|
||||||
items: result
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
const remoteTrailers = item.RemoteTrailers || [];
|
|
||||||
|
|
||||||
if (!remoteTrailers.length) {
|
|
||||||
return Promise.reject();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.play({
|
if (!items || !items.length) {
|
||||||
items: remoteTrailers.map(function (t) {
|
items = (item.RemoteTrailers || []).map((t) => {
|
||||||
return {
|
return {
|
||||||
Name: t.Name || (item.Name + ' Trailer'),
|
Name: t.Name || (item.Name + ' Trailer'),
|
||||||
Url: t.Url,
|
Url: t.Url,
|
||||||
|
@ -3532,9 +3523,16 @@ class PlaybackManager {
|
||||||
Type: 'Trailer',
|
Type: 'Trailer',
|
||||||
ServerId: apiClient.serverId()
|
ServerId: apiClient.serverId()
|
||||||
};
|
};
|
||||||
})
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (items.length) {
|
||||||
|
return this.play({
|
||||||
|
items
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return Promise.reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
getSubtitleUrl(textStream, serverId) {
|
getSubtitleUrl(textStream, serverId) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue