mirror of
https://github.com/jellyfin/jellyfin-vue.git
synced 2024-11-27 00:00:23 +00:00
Merge pull request #759 from jellyfin/playback-fix
fix(playback manager): reset time when moving between tracks
This commit is contained in:
commit
7b614c49b1
@ -256,13 +256,15 @@ test('When "INCREASE_QUEUE_INDEX" is committed, currentItemIndex is increased. C
|
||||
store.replaceState({
|
||||
...defaultState(),
|
||||
currentItemIndex: 1,
|
||||
lastItemIndex: 0
|
||||
lastItemIndex: 0,
|
||||
currentTime: 100
|
||||
});
|
||||
|
||||
store.commit('INCREASE_QUEUE_INDEX');
|
||||
|
||||
expect(store.state.currentItemIndex).toBe(2);
|
||||
expect(store.state.lastItemIndex).toBe(1);
|
||||
expect(store.state.currentTime).toBe(0);
|
||||
});
|
||||
|
||||
test('When "DECREASE_QUEUE_INDEX" is committed, currentItemIndex is decreased. Case A', () => {
|
||||
@ -278,12 +280,14 @@ test('When "DECREASE_QUEUE_INDEX" is committed, currentItemIndex is decreased. C
|
||||
test('When "DECREASE_QUEUE_INDEX" is committed, currentItemIndex is decreased. Case B', () => {
|
||||
store.replaceState({
|
||||
...defaultState(),
|
||||
currentItemIndex: 2
|
||||
currentItemIndex: 2,
|
||||
currentTime: 1
|
||||
});
|
||||
|
||||
store.commit('DECREASE_QUEUE_INDEX');
|
||||
|
||||
expect(store.state.currentItemIndex).toBe(1);
|
||||
expect(store.state.currentTime).toBe(0);
|
||||
});
|
||||
|
||||
test('When "START_PLAYBACK" is committed, status is set to playing.', () => {
|
||||
|
@ -167,11 +167,14 @@ export const mutations: MutationTree<PlaybackManagerState> = {
|
||||
if (state.currentItemIndex !== null) {
|
||||
state.lastItemIndex = state.currentItemIndex;
|
||||
state.currentItemIndex += 1;
|
||||
state.currentTime = 0;
|
||||
}
|
||||
},
|
||||
DECREASE_QUEUE_INDEX(state: PlaybackManagerState) {
|
||||
if (state.currentItemIndex !== null) {
|
||||
state.lastItemIndex = state.currentItemIndex;
|
||||
state.currentItemIndex -= 1;
|
||||
state.currentTime = 0;
|
||||
}
|
||||
},
|
||||
START_PLAYBACK(
|
||||
|
Loading…
Reference in New Issue
Block a user