Skip to content

Commit

Permalink
Display content only if player is idle
Browse files Browse the repository at this point in the history
This ensures content is not displayed on screen if player is buffering.
  • Loading branch information
3flex committed Nov 4, 2024
1 parent c36bc05 commit 6591f61
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/commandHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export abstract class CommandHandler {
}

static displayContentHandler(data: DataMessage): void {
if (!PlaybackManager.isPlaying()) {
if (PlaybackManager.isIdle()) {
DocumentManager.showItemId((data.options as DisplayRequest).ItemId);
}
}
Expand Down
7 changes: 7 additions & 0 deletions src/components/playbackManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ export abstract class PlaybackManager {
);
}

static isIdle(): boolean {
return (
this.playerManager.getPlayerState() ===
cast.framework.messages.PlayerState.IDLE
);
}

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

Expand Down

0 comments on commit 6591f61

Please sign in to comment.