React Cast Sender
Package for easy setup and use of Chromecast (CAF) with React. Will automaticly include and load Cast SDK and initialize player.
Todo
- Add MiniController
- Add FullController
- Expose QUEUE Api
Installation
yarn add react-cast-sender
Make sure to install peerDependencies
yarn add react react-dom styled-components
Documentation
Context
CastProvider
Context to serve Cast. Should be wrapped around your application
PropType | type | required | default |
---|---|---|---|
receiverApplicationId | string | yes | null |
autoJoinPolicy | string | no | ORIGIN_SCOPED |
language | string | no | null |
resumeSavedSession | boolean | no | ? |
Example:
; const App = { return <CastProvider receiverApplicationId='my-cast-id'>children</CastProvider> ;};
Components
CastButton
Will render a CastButton if there are chromecast available to cast to
Example:
; const App = { return <CastButton />;};
Hooks
useCast
Example:
; const App = { const initialized connected deviceName = ; return ... ;};
useCastPlayer
Example:
; const App = { const loadMedia currentTime duration isPaused isMediaLoaded togglePlay seek isMuted tracks editTracks thumbnail title setVolume toggleMute } = ; return ... ;};