This repository has been archived by the owner on May 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
2,369 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# `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 like the other screen presentation API's. | ||
|
||
This is the simplest way to add a Chromecast support to [Media Chrome](https://github.com/muxinc/media-chrome). | ||
|
||
|
||
```html | ||
<script src="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1"></script> | ||
<script type="module" src="./castable-video.js"></script> | ||
|
||
<video | ||
slot="media" | ||
is="castable-video" | ||
poster="https://image.mux.com/DS00Spx1CV902MCtPj5WknGlR102V5HFkDe/thumbnail.jpg" | ||
src="https://stream.mux.com/DS00Spx1CV902MCtPj5WknGlR102V5HFkDe/high.mp4" | ||
muted | ||
crossorigin | ||
></video> | ||
``` | ||
|
||
## 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 `<video "stream-type="live">` for live streams. | ||
- `cast-src`: if Chromecast requires a different source than the one loaded. |
Oops, something went wrong.