Skip to content

Commit

Permalink
fix: preserve context
Browse files Browse the repository at this point in the history
  • Loading branch information
kkmch committed Oct 19, 2023
1 parent 51ef07a commit 101bc2e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/components/ReactPlayer/ReactPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@ export const ReactPlayerBlock = React.forwardRef<ReactPlayerBlockRefType, ReactP
return;
}

const {play, pause, addEventListener} =
playerRef.getInternalPlayer() as HTMLVideoElement;
const videoInstance = playerRef.getInternalPlayer() as HTMLVideoElement;
const {play, pause, addEventListener} = videoInstance;

// eslint-disable-next-line consistent-return
return {
play,
pause,
addEventListener,
play: play.bind(videoInstance),
pause: pause.bind(videoInstance),
addEventListener: addEventListener.bind(videoInstance),
};
},
[playerRef],
Expand Down

0 comments on commit 101bc2e

Please sign in to comment.