The <Plyr /> component is the simplest way to integrate a media player. You must import the plyr-react/plyr.css stylesheet to apply the default theme.
Important CSS Path Change: As of v5.0.0, use plyr-react/plyr.css. For older versions (v4), use plyr-react/dist/plyr.css.
import Plyr from "plyr-react"
import "plyr-react/plyr.css"
// Player source configuration
const plyrProps = {
source: {
type: "video",
sources: [
{
src: "https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-720p.mp4",
type: "video/mp4",
size: 720,
},
],
poster:
"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg",
},
options: {
// Full list of options: https://github.com/sampotts/plyr#options
controls: [
"play-large",
"play",
"progress",
"current-time",
"mute",
"volume",
"captions",
"settings",
"pip",
"airplay",
"fullscreen",
],
},
}
function MyPlayer() {
return <Plyr {...plyrProps} />
}