Skip to content

Commit ba756d2

Browse files
authored
fix(mux-player-react): Update order of props setting so playback id always comes first to resolve session-based expectations (e.g. mux data metadata). (#1164)
To validate, use https://elements-demo-nextjs-git-fork-cjpillsbury-fix-mux-da-eeafeb-mux.vercel.app/MuxNewsPlayer and confirm video titles are different and expected for each playlist item in our Mux Data Views.
1 parent 23b2d85 commit ba756d2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/mux-player-react/src/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,16 @@ const usePlayer = (
6969
_hlsConfig,
7070
...remainingProps
7171
} = props;
72+
// NOTE: We should set playbackId before all other props to ensure that any playback/view session-specific props are applied to the approrpiate
73+
// session. "Under the hood," we wait one frame before (re)initializing playback core (and thus e.g. hls.js and mux-embed data sdk), so everything
74+
// should be applied as expected as a result.
75+
useObjectPropEffect('playbackId', playbackId, ref);
7276
useObjectPropEffect('playbackRates', playbackRates, ref);
7377
useObjectPropEffect('metadata', metadata, ref);
7478
useObjectPropEffect('extraSourceParams', extraSourceParams, ref);
7579
useObjectPropEffect('_hlsConfig', _hlsConfig, ref);
7680
useObjectPropEffect('themeProps', themeProps, ref);
7781
useObjectPropEffect('tokens', tokens, ref);
78-
useObjectPropEffect('playbackId', playbackId, ref);
7982
useObjectPropEffect('castCustomData', castCustomData, ref);
8083
useObjectPropEffect(
8184
'paused',

0 commit comments

Comments
 (0)