Skip to content

Commit

Permalink
Refactor commandHandler to use PlaybackState
Browse files Browse the repository at this point in the history
  • Loading branch information
YouKnowBlom committed Aug 1, 2021
1 parent a7f31a2 commit 0f62137
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/components/commandHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,17 @@ export abstract class CommandHandler {
}

static setAudioStreamIndexHandler(data: DataMessage): void {
setAudioStreamIndex($scope, (<SetIndexRequest>data.options).index);
setAudioStreamIndex(
this.playbackManager.playbackState,
(<SetIndexRequest>data.options).index
);
}

static setSubtitleStreamIndexHandler(data: DataMessage): void {
setSubtitleStreamIndex($scope, (<SetIndexRequest>data.options).index);
setSubtitleStreamIndex(
this.playbackManager.playbackState,
(<SetIndexRequest>data.options).index
);
}

// VolumeUp, VolumeDown and ToggleMute commands seem to be handled on the sender in the current implementation.
Expand Down Expand Up @@ -143,16 +149,19 @@ export abstract class CommandHandler {
} else {
// When a client connects send back the initial device state (volume etc) via a playbackstop message
reportPlaybackProgress(
$scope,
getReportingParams($scope),
this.playbackManager.playbackState,
getReportingParams(this.playbackManager.playbackState),
true,
'playbackstop'
);
}
}

static SeekHandler(data: DataMessage): void {
seek((<SeekRequest>data.options).position * 10000000);
seek(
this.playbackManager.playbackState,
(<SeekRequest>data.options).position * 10000000
);
}

static MuteHandler(): void {
Expand Down

0 comments on commit 0f62137

Please sign in to comment.