Skip to content

Commit d193d01

Browse files
authored
Merge pull request #2380 from tf/fix-replay-last-frame-flash
Fix flash of last frame on replay
2 parents 39b066f + 0416ece commit d193d01

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

entry_types/scrolled/package/spec/frontend/usePlayerState-spec.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,15 +238,25 @@ describe('usePlayerState', () => {
238238
expect(nextState.unplayed).toBe(true);
239239
});
240240

241-
it('is no longer unplayed after play action', () => {
241+
it('is no longer unplayed after playing action', () => {
242242
const {result} = renderHookInEntry(() => usePlayerState());
243243
const [,actions] = result.current;
244244
act(() => actions.play());
245+
act(() => actions.playing());
245246
const [nextState,] = result.current;
246247

247248
expect(nextState.unplayed).toBe(false);
248249
});
249250

251+
it('stays unplayed after play action until playing', () => {
252+
const {result} = renderHookInEntry(() => usePlayerState());
253+
const [,actions] = result.current;
254+
act(() => actions.play());
255+
const [nextState,] = result.current;
256+
257+
expect(nextState.unplayed).toBe(true);
258+
});
259+
250260
it('becomes unplayed again when video ends to make it return to its initial look', () => {
251261
const {result} = renderHookInEntry(() => usePlayerState());
252262
const [,actions] = result.current;

entry_types/scrolled/package/src/frontend/MediaPlayer/usePlayerState.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ export function playerStateReducer(state, action){
4242
isLoading: true,
4343
shouldPlay: true,
4444
playFailed: false,
45-
unplayed: false,
4645
lastControlledVia: action.payload.via
4746
};
4847
case PLAYING:
4948
return {
5049
...state,
5150
shouldPlay: true,
5251
isPlaying: true,
52+
unplayed: false,
5353
userIdle: false
5454
};
5555
case PLAY_AND_FADE_IN:

0 commit comments

Comments
 (0)