mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-20 01:54:01 +00:00
don't cycle presets when media is not playing (#799)
This commit is contained in:
parent
fd4f15441d
commit
35c9167f2d
1 changed files with 4 additions and 1 deletions
|
|
@ -25,6 +25,7 @@ interface StateProps {
|
|||
presetsAreCycling: boolean;
|
||||
currentPresetIndex: number | null; // Index
|
||||
trackTitle: string | null;
|
||||
mediaIsPlaying: boolean;
|
||||
}
|
||||
|
||||
interface DispatchProps {
|
||||
|
|
@ -107,7 +108,7 @@ function Milkdrop(props: Props) {
|
|||
|
||||
// Cycle presets
|
||||
useEffect(() => {
|
||||
if (!props.presetsAreCycling) {
|
||||
if (!props.presetsAreCycling || !props.mediaIsPlaying) {
|
||||
return;
|
||||
}
|
||||
const intervalId = setInterval(
|
||||
|
|
@ -119,6 +120,7 @@ function Milkdrop(props: Props) {
|
|||
props.selectNextPreset,
|
||||
props.presetsAreCycling,
|
||||
props.currentPresetIndex,
|
||||
props.mediaIsPlaying,
|
||||
]);
|
||||
|
||||
const screenSize = useScreenSize();
|
||||
|
|
@ -173,6 +175,7 @@ const mapStateToProps = (state: AppState): StateProps => ({
|
|||
presetsAreCycling: Selectors.getPresetsAreCycling(state),
|
||||
currentPresetIndex: Selectors.getCurrentPresetIndex(state),
|
||||
trackTitle: Selectors.getCurrentTrackDisplayName(state),
|
||||
mediaIsPlaying: Selectors.getMediaIsPlaying(state),
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch: Dispatch): DispatchProps => ({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue