Skip to content

Does mux-video-react package offer programmatic play and pause of the video? #680

Answered by gkatsev
GuruPrakashDavala asked this question in Q&A
Discussion options

You must be logged in to vote

mux-video-react doesn't offer something directly for that. You're expected to get the reference to the media element and then call play or pause on that.

We have an example https://github.com/muxinc/elements/blob/main/examples/nextjs-with-typescript/pages/MuxVideo.tsx, which shows how to get the ref. I just submitted a PR to update the example to also use the ref to toggle playback via a checkbox: #681. You can see a preview of it here https://elements-demo-nextjs-git-fork-gkatsev-muxvideo-example-mux.vercel.app/MuxVideo

Hope this helps.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by GuruPrakashDavala
Comment options

You must be logged in to vote
1 reply
@gkatsev
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants