API Reference
Main exports
Main component and hooks
useYouTubePlayer(source, config?)
Creates a player instance from a video ID or YouTube URL.
YoutubeView
Renders the player instance.
useYouTubeEvent(player, event, ...)
Subscribes to player updates.
useYoutubeOEmbed(url?)
Fetches optional metadata for richer UI.
Player methods
play,pause,stop,seekTosetVolume,getVolume,mute,unMute,isMutedgetCurrentTime,getDuration,getVideoUrl,getVideoEmbedCodegetPlaybackRate,setPlaybackRate,getAvailablePlaybackRatesgetPlayerState,getVideoLoadedFractionloadVideoById,cueVideoById,setSize
Async getter methods should be called after the
readyevent when you need reliable values. Before the render surface is attached, they can returnundefined.
Events
readystateChangeerrorprogressplaybackRateChangeplaybackQualityChangeautoplayBlockedmuteChange
Important types
YoutubeSourceYoutubePlayerVarsYoutubeErrorProgressDataPlayerInfoPlayerStateYoutubeViewProps
For behavior details, follow the guide pages instead of treating this page as the primary onboarding surface.
YoutubeView props
player
The YoutubePlayer instance returned from useYouTubePlayer. Pass the same instance to YoutubeView so the view can attach to the controller used by hooks and method calls.
width / height
Controls the rendered player size. Both props accept a number, 'auto', or a percentage string such as '100%'.
style
Applies React Native view styles to the player container.
iframeStyle (web only)
Applies CSS properties to the iframe wrapper on React Native Web.
useInlineHtml (iOS / Android, default: true)
When true, the native WebView receives inline HTML. When false, the WebView loads the default hosted player page (https://react-native-youtube-bridge.pages.dev) or the URL supplied by webViewUrl.
webViewUrl (iOS / Android)
Overrides the WebView source URL, or becomes the baseUrl when useInlineHtml is true.
When using inline HTML, the webViewUrl origin must exactly match the YouTube IFrame API origin value. Include the port when needed, use a trailing slash for the baseUrl, and omit the trailing slash from the origin.
webViewStyle (iOS / Android)
Applies React Native view styles directly to the underlying WebView.
webViewProps (iOS / Android)
Passes additional props to the underlying WebView while preserving the internal props controlled by this library. ref, source, style, onMessage, javaScriptEnabled, and onError are managed internally and cannot be overridden.
