Don't autoplay on next when stoppedFixes #730

This commit is contained in:
Jordan Eldredge 2019-03-25 06:30:33 -07:00
parent 28f0f98eb1
commit dd1f6164d9
2 changed files with 16 additions and 2 deletions

View file

@ -8,6 +8,7 @@
### Bug Fixes:
- Fix a bug where context menus could appear in the wrong location ([95db2d](https://github.com/captbaritone/webamp/commit/95db2d08b6b189f5b9da577d23aca44b04c462a8))
- Fix a bug where pressing next/previous when stopped would play the track ([#740](https://github.com/captbaritone/webamp/issues/730))
## 1.3.1 [CURRENT]

View file

@ -10,6 +10,7 @@ import {
PAUSE,
PLAY_TRACK,
TOGGLE_TIME_MODE,
BUFFER_TRACK,
} from "../actionTypes";
import { MEDIA_STATUS } from "../constants";
@ -31,7 +32,19 @@ function playRandomTrack(): Dispatchable {
} while (nextId === currentTrack && trackOrder.length > 1);
// TODO: Sigh... Technically, we should detect if we are looping only repeat if we are.
// I think this would require pre-computing the "random" order of a playlist.
dispatch({ type: PLAY_TRACK, id: nextId });
dispatch(playTrack(nextId));
};
}
function playTrack(id: number): Dispatchable {
return (dispatch, getState) => {
const state = getState();
const isStopped = Selectors.getMediaStatus(state) === MEDIA_STATUS.STOPPED;
if (isStopped) {
dispatch({ type: BUFFER_TRACK, id });
} else {
dispatch({ type: PLAY_TRACK, id });
}
};
}
@ -76,7 +89,7 @@ export function nextN(n: number): Dispatchable {
if (nextTrackId == null) {
return;
}
dispatch({ type: PLAY_TRACK, id: nextTrackId });
dispatch(playTrack(nextTrackId));
};
}