Skip to content

Commit

Permalink
try to fix the startIndex issue
Browse files Browse the repository at this point in the history
  • Loading branch information
hawken93 committed Jan 4, 2021
1 parent c84ef49 commit 86b19ce
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/components/playbackManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export abstract class PlaybackManager {
);
}

static async playFromOptions(options: any): Promise<boolean> {
static async playFromOptions(options: any): Promise<void> {
const firstItem = options.items[0];

if (options.startPositionTicks || firstItem.MediaType !== 'Video') {
Expand All @@ -68,17 +68,18 @@ export abstract class PlaybackManager {
return this.playFromOptionsInternal(options);
}

private static playFromOptionsInternal(options: any): boolean {
private static playFromOptionsInternal(options: any): Promise<void> {
const stopPlayer =
this.activePlaylist && this.activePlaylist.length > 0;

this.activePlaylist = options.items;
// We need to set -1 so the next index will be 0
this.activePlaylistIndex = -1;
this.activePlaylistIndex = options.startIndex || 0;

console.log('Loaded new playlist:', this.activePlaylist);

return this.playNextItem(options, stopPlayer);
// When starting playback initially, don't use
// the next item facility.
return this.playItem(options, stopPlayer);
}

// add item to playlist
Expand Down

0 comments on commit 86b19ce

Please sign in to comment.