NusaPlayer

Chromecast

Cast the current video when Chrome / Edge exposes the Cast API.

npm i @nusaplayer/plugins
import { Chromecast } from '@nusaplayer/plugins'
 
Player.make('#player', {
  source: { src: 'https://vjs.zencdn.net/v/oceans.mp4' }
})
  .use([ui(), new Chromecast()])
  .create()
<script src="https://cdn.jsdelivr.net/npm/@nusaplayer/plugins@latest/dist/chromecast.min.js"></script>
<script>
  NusaPlayer.make('#player').use([NusaUI(), new NusaChromecast()]).create()
</script>

The icon only appears when chrome.cast is available (typically desktop Chrome on https).

While a session is connected, play / pause / seek / volume on this player control the TV. Local playback is paused so audio is not doubled. Click the icon again to stop casting and resume here. Source changes reload media on the receiver.

Events: caststart, castend, cast-error.