Cast your video element to the big screen with ease!

Overview

is="castable-video"

Cast your video element to the big screen with ease!

The lightweight CastableVideoElement class extends the native HTMLVideoElement API and adds casting functionality to any video element. The API was designed to have the feel of a native browser API similar to the other screen presentation API's.

It was primarily built for use in Media Chrome but it works great with any custom video controls as you can see in the example.

<script src="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/castable-video"></script>

<video
  id="castable"
  is="castable-video"
  src="https://stream.mux.com/DS00Spx1CV902MCtPj5WknGlR102V5HFkDe/high.mp4"
></video>

<button onclick="window.castable.play()">Play</button>
<button onclick="window.castable.pause()">Pause</button>
<button onclick="window.castable.requestCast()">Request Cast</button>
<button onclick="window.CastableVideoElement.exitCast()">Exit Cast</button>
<script>
  window.castable.addEventListener('castchange', function (event) {
    console.log(event.type, event.detail);
  });
</script>

API

Methods

  • video.requestCast(options): open the browser casting menu. Options:
    • receiverApplicationId: defaults to Chromecast default receiver.
    • autoJoinPolicy ('ORIGIN_SCOPED')
    • androidReceiverCompatible (false): if true enables Cast Connect.
    • language ('en-US')
    • resumeSavedSession (false)
  • CastableVideoElement.exitCast(): stop casting right away.

Properties

  • CastableVideoElement.castElement: the current video element being cast.
  • CastableVideoElement.castEnabled: true when the Cast SDK is available.

Events

  • castchange: fires when cast status changes. e.g. cast device detected.
  • entercast: fires when starting casting.
  • leavecast: fires when stopping casting.

e.g. video.addEventListener('entercast', () => {})

Attributes

  • cast-src: if Chromecast requires a different source than the one loaded.
    For example this would be needed if video src is a blob when using MSE.
  • cast-stream-type: add <video cast-stream-type="live"> for live streams.
  • cast-content-type: required if Chromecast can't derive the content type from the source.
You might also like...

MyTV is a web-based IPTV UI for your TV Box (embedded device what streams video to TV)

MyTV is a web-based IPTV UI for your TV Box (embedded device what streams video to TV)

MyTV is a web-based IPTV UI for your TV Box (embedded device what streams video to TV). Features Console for debug Load a playlist Live a TV channel A

Sep 10, 2022

A custom element (web component) for the Vimeo player.

vimeo-video A custom element (web component) for Vimeo. The element API matches the HTML5 video tag, so it can be easily swapped with other media,

Dec 28, 2022

A custom element (web component) for Shaka Player.

shaka-video A custom element (web component) for Shaka Player, which supports both HLS and DASH streaming protocols. The element API matches the HTM

Dec 14, 2022

Enables video and audio tags in all major browsers.

HTML5 video made easy All it takes is a single line of code to make HTML5 video and audio tags work in all major browsers. How to enable video and aud

Dec 17, 2022

The HTML5 video player for the web

Flowplayer website | demos | docs For the impatient Download Flowplayer Unzip Drop the folder under your server Minimal setup !DOCTYPE html head

Dec 30, 2022

HTML5 audio or video player with support for MP4, WebM, and MP3 as well as HLS, Dash, YouTube, Facebook, SoundCloud and others with a common HTML5 MediaElement API, enabling a consistent UI in all browsers.

HTML5 <audio> or <video> player with support for MP4, WebM, and MP3 as well as HLS, Dash, YouTube, Facebook, SoundCloud and others with a common HTML5 MediaElement API, enabling a consistent UI in all browsers.

One file. Any browser. Same UI. Author: John Dyer http://j.hn/ Website: http://mediaelementjs.com/ License: MIT Meaning: Use everywhere, keep copyrigh

Dec 27, 2022

A lightweight, easy-to-use jQuery plugin for fluid width video embeds.

Introducing FitVids.js A lightweight, easy-to-use jQuery plugin for fluid width video embeds. FitVids automates the Intrinsic Ratio Method by Thierry

Dec 24, 2022

HTML5 audio or video player with support for MP4, WebM, and MP3 as well as HLS, Dash, YouTube, Facebook, SoundCloud and others with a common HTML5 MediaElement API, enabling a consistent UI in all browsers.

HTML5 <audio> or <video> player with support for MP4, WebM, and MP3 as well as HLS, Dash, YouTube, Facebook, SoundCloud and others with a common HTML5 MediaElement API, enabling a consistent UI in all browsers.

One file. Any browser. Same UI. Author: John Dyer http://j.hn/ Website: http://mediaelementjs.com/ License: MIT Meaning: Use everywhere, keep copyrigh

Jan 8, 2023

A web video player built for the HTML5 world using React library.

video-react Video.React is a web video player built from the ground up for an HTML5 world using React library. Installation Install video-react and pe

Jan 6, 2023
Comments
  • Remote Playback API

    Remote Playback API

    Look into the Remote Playback API https://w3c.github.io/remote-playback/ and see if it's worth to patch it on Chrome desktop to work with the Cast SDK.

    According to this Android Chrome already supports the Remote Playback API. Does it still? https://chromestatus.com/feature/5778318691401728

    opened by luwes 0
  • casting attempt feedback?

    casting attempt feedback?

    I clicked on [Request Cast] in demo app, but there was no UI nor console feedback that there was no Cast devise set up. (I clicked knowing it would fail).

    Thanks for building this; might end up using for a video education platform.

    enhancement 
    opened by tomByrer 1
Releases(v0.5.0)
Custom full screen video player

Video Player Native video player in html View Demo · Report Bug · Request Feature About The Project This is a custom video player for the web built on

Oscar Castaneda ⬢ 5 Feb 3, 2022
Custom element (web component) for Video.js.

<videojs-video> A custom element (web component) for Video.js. The element API matches the HTML5 <video> tag, so it can be easily swapped with other m

Wesley Luyten 5 Jul 11, 2022
Video.js - open source HTML5 & Flash video player

Video.js - HTML5 Video Player Video.js is a web video player built from the ground up for an HTML5 world. It supports HTML5 video and Media Source Ext

Video.js 34.8k Jan 5, 2023
A Node JS Express/Serverless demo application that creates a slideshow video using the Pexels image library and Shotstack video editing API.

Shotstack Pexels Slideshow Video Demo This project demonstrates how to use the Shotstack cloud video editing API to create a video using an HTML form

Shotstack 25 Dec 9, 2022
A Chrome extension to help you inspect Mp4 video content and find irregularities in video streams.

MP4Inspector A Chrome extension to help you inspect Mp4 video content and find irregularities in video streams. Installation In chrome navigate to chr

Bitmovin 48 Nov 28, 2022
This Program was designed to Autocatch Pokétwo spawns but It is loaded with versatile and huge functions/Utilities With ease to handle.

Pokétwo ∆ Automation The most legit & advanced Poketwo autocatcher and one click setup with ease of handling with: auto catch pokemons, Market sniper,

Banerus 1.6k Dec 28, 2022
A simple library for using the JavaScript Full Screen API.

BigScreen A simple library for using the JavaScript Fullscreen API. Why should I use it? BigScreen makes it easy to use full screen on your site or in

Brad Dougherty 712 Dec 22, 2022
Enable full screen on for large aspect ratio screens on WhatsApp Web.

Maximize WhatsApp [WIP] Enable full screen on large aspect ratio screens on WhatsApp Web. Enable Epiphany extension. Optional if not done. Download th

null 2 Mar 13, 2022
Get your video lectures summed up in a few minutes

Nutshell allows students to quickly summarise their entire video lectures in just a few minutes. Whether it's for a quick revision, catching up on missed classes, or simply a reference for what happened, Nutshell helps students by providing them with the most important parts of the class without them having to watch a second of the recorded video.

Lakshya 5 Sep 17, 2022
MyTV is a web-based IPTV UI for your TV Box (embedded device what streams video to TV)

MyTV is a web-based IPTV UI for your TV Box (embedded device what streams video to TV). Features Console for debug Load a playlist Live a TV channel A

Henry Barreto 6 Oct 7, 2022