From 5f32587ea1d6ef7ba0f494f9662f04cf3b360e75 Mon Sep 17 00:00:00 2001 From: Wesley Luyten Date: Thu, 19 May 2022 20:38:39 -0500 Subject: [PATCH] feat: add castable-video (#1) --- .gitignore | 1 + README.md | 54 ++ castable-video.js | 543 +++++++++++++++ en-cc.vtt | 33 + index.html | 82 +++ package-lock.json | 1607 +++++++++++++++++++++++++++++++++++++++++++++ package.json | 56 ++ 7 files changed, 2376 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 castable-video.js create mode 100644 en-cc.vtt create mode 100644 index.html create mode 100644 package-lock.json create mode 100644 package.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2ccbe46 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/node_modules/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..299f346 --- /dev/null +++ b/README.md @@ -0,0 +1,54 @@ +# `is="castable-video"` + +Cast your video element to the big screen with ease! + +The lightweight `CastableVideo` 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](https://github.com/muxinc/media-chrome) but it works great with any custom video controls as you can see in the example. + + +```html + + + + + + + + + + +``` + +## API + +### Methods + +- `video.requestCast(options)` +- `CastableVideo.exitCast()` + +### Properties + +- `CastableVideo.castElement` +- `CastableVideo.castAvailable` + +### Events + +- `entercast` +- `leavecast` +- `castchange` + +e.g. `video.addEventListener('entercast', () => {})` + +### Attributes + +- `stream-type`: add `