Make pause button unpause.

This commit is contained in:
Matthew Stratford 2021-04-24 21:41:19 +01:00
parent 2b151649c9
commit 4a0958f1e5
2 changed files with 11 additions and 1 deletions

View file

@ -445,6 +445,10 @@ export const pause = (player: number): AppThunk => (dispatch, getState) => {
sendBAPSicleChannel({ channel: player, command: "PAUSE" });
};
export const unpause = (player: number): AppThunk => (dispatch, getState) => {
sendBAPSicleChannel({ channel: player, command: "UNPAUSE" });
};
export const stop = (player: number): AppThunk => (dispatch, getState) => {
sendBAPSicleChannel({ channel: player, command: "STOP" });
};

View file

@ -368,7 +368,13 @@ export function Player({ id }: { id: number }) {
<FaPlay />
</button>
<button
onClick={() => dispatch(MixerState.pause(id))}
onClick={() =>
dispatch(
playerState.state === "paused"
? MixerState.unpause(id)
: MixerState.pause(id)
)
}
className={
playerState.state === "paused" ? "sp-state-paused" : ""
}