Updating the Media component

We will create a new MediaPlayer component that will contain the customized ReactPlayer. In the Media component, we will replace the previously used ReactPlayer with the new MediaPlayer component, and pass on the video source URL, the next video's URL and the handleAutoPlay method, which are received as props from the PlayMedia component.

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

const mediaUrl = this.props.media._id          ? `/api/media/video/${this.props.media._id}`          : null...<MediaPlayer srcUrl={mediaUrl}              nextUrl={this.props.nextUrl}              handleAutoplay={this.props.handleAutoplay}/>

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.