From 0416ece435b3029f9dc6c5cce45279edb1dd2293 Mon Sep 17 00:00:00 2001 From: Tim Fischbach Date: Fri, 20 Mar 2026 12:50:32 +0100 Subject: [PATCH] Keep unplayed state until playback actually starts Delay clearing the unplayed flag from the play action to the playing action. This prevents the player from briefly showind the last frame when playing again having played until the end. REDMINE-21248 --- .../package/spec/frontend/usePlayerState-spec.js | 12 +++++++++++- .../src/frontend/MediaPlayer/usePlayerState.js | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/entry_types/scrolled/package/spec/frontend/usePlayerState-spec.js b/entry_types/scrolled/package/spec/frontend/usePlayerState-spec.js index 23084d1903..23077778bc 100644 --- a/entry_types/scrolled/package/spec/frontend/usePlayerState-spec.js +++ b/entry_types/scrolled/package/spec/frontend/usePlayerState-spec.js @@ -238,15 +238,25 @@ describe('usePlayerState', () => { expect(nextState.unplayed).toBe(true); }); - it('is no longer unplayed after play action', () => { + it('is no longer unplayed after playing action', () => { const {result} = renderHookInEntry(() => usePlayerState()); const [,actions] = result.current; act(() => actions.play()); + act(() => actions.playing()); const [nextState,] = result.current; expect(nextState.unplayed).toBe(false); }); + it('stays unplayed after play action until playing', () => { + const {result} = renderHookInEntry(() => usePlayerState()); + const [,actions] = result.current; + act(() => actions.play()); + const [nextState,] = result.current; + + expect(nextState.unplayed).toBe(true); + }); + it('becomes unplayed again when video ends to make it return to its initial look', () => { const {result} = renderHookInEntry(() => usePlayerState()); const [,actions] = result.current; diff --git a/entry_types/scrolled/package/src/frontend/MediaPlayer/usePlayerState.js b/entry_types/scrolled/package/src/frontend/MediaPlayer/usePlayerState.js index 527f46532e..2496e37814 100644 --- a/entry_types/scrolled/package/src/frontend/MediaPlayer/usePlayerState.js +++ b/entry_types/scrolled/package/src/frontend/MediaPlayer/usePlayerState.js @@ -42,7 +42,6 @@ export function playerStateReducer(state, action){ isLoading: true, shouldPlay: true, playFailed: false, - unplayed: false, lastControlledVia: action.payload.via }; case PLAYING: @@ -50,6 +49,7 @@ export function playerStateReducer(state, action){ ...state, shouldPlay: true, isPlaying: true, + unplayed: false, userIdle: false }; case PLAY_AND_FADE_IN: