Video player

Use the video player component to enable playback of self-hosted videos
  • Experimental
  • Not reviewed for accessibility
import {VideoPlayer} from '@primer/react-brand'

Examples

Default

With poster

Without branding

Component props

VideoPlayer Required

VideoPlayer provides a React alternative to the native HTML <video />.

NameTypeDefaultRequiredDescription
titlestringtrueSets the title of the video
childrenReact.ReactNode, React.ReactNode[]trueTakes <source> and <track> elements to present video information
posterstringfalseSets an image as the starting frame for the video element
brandingbooleanfalseDisplays GitHub branding next to video title
classNamestringfalseSets a custom class

The component API supports all standard HTML attribute props, while providing some additional behavior as described above.

VideoPlayer.Source Required

VideoPlayer.Source provides a React alternative to the native HTML <source />.

NameTypeDefaultRequiredDescription
srcstringtrueSets the URL of the video content
typestringfalseSets media type for the video content

The component API supports all standard HTML attribute props, while providing some additional behavior as described above.

VideoPlayer.Track Required

VideoPlayer.Track provides a React alternative to the native HTML <track />.

NameTypeDefaultRequiredDescription
srcstringtrueSets the source of the VTT file containing captions
kind'subtitles', 'captions', 'descriptions', 'chapters', 'metadata'falseSets how the text track is meant to be used
srcLangstringfalseLanguage of the text data. It must be a valid BCP 47 language tag.
labelstringfalseA user-readable title of the text track which is used by the browser when listing available text tracks.
defaultbooleanfalseThis attribute indicates that the track should be enabled unless the user's preferences indicate that another track is more appropriate.

The component API supports all standard HTML attribute props, while providing some additional behavior as described above.