Play, pause, and replay

Users will be able to play, pause, and replay the current video, and we will implement these three options using Material-UI components bound to ReactPlayer attributes and events:

To implement the play, pause, and replay functionality, we will add a play, pause, or replay icon button conditionally depending on whether the video is playing, paused, or has ended.

mern-mediastream/client/media/MediaPlayer.js:

<IconButton color="primary" onClick={this.playPause}>    <Icon>{playing ? 'pause': (ended ? 'replay' : 'play_arrow')}</Icon></IconButton>

When the user clicks the button, we will update the playing value in state, so ...

Get Full-Stack React Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.