Loop on ended

Users will also be able to set the current video to keep playing in a loop using the loop button:

We will set up a loop icon button that will render in a different color to indicate whether it is set or unset.

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

<IconButton color={loop? 'primary' : 'default'}             onClick={this.onLoop}>    <Icon>loop</Icon></IconButton>

When the loop icon button is clicked, it updates the loop value in state.

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

onLoop = () => {   this.setState({ loop: !this.state.loop })}

We will need to catch the onEnded event, to check whether loop has been set to true, so the

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.