Toggling autoplay

Besides letting the user set autoplay, the toggle will also indicate whether it is currently set or not:

For the autoplay toggle, we will use a Material-UI Switch component along with a FormControlLabel, and add it to the PlayMedia component over the RelatedMedia component to be rendered only when there are media in the related media list.

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

<FormControlLabel     control={            <Switch              checked={this.state.autoPlay}              onChange={this.handleChange}              color="primary"            />          }    label={this.state.autoPlay? 'Autoplay ON':'Autoplay OFF'}/>

To handle the change to the toggle and reflect it in the state's ...

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.