React media player to render the video

A good option for a React-flavored media player is the ReactPlayer component available as an npm, which can be customized as required:

It can be used in the application by installing the corresponding npm module:

npm install react-player --save

For basic usage with default controls provided by the browser, we can add it to any React view in the application that has access to the ID of the media to be rendered:

<ReactPlayer url={'/api/media/video/'+media._id} controls/>

In the next chapter, we will look into advanced options for customizing this ReactPlayer with our own controls.

To learn more about what ...

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.