castable-video
castable-video copied to clipboard
Is it possible to make this work with audio?
I'm trying to use the media-chrome library to build an audio player. I need to enable Chromecasting for my audio. Having delved through the source-code it appears the media-controller is building on this castable-video element for its chromecast behaviour.
Is there any way you can enhance castable-video to support audio elements too?
thanks for the feedback! yes, that's a good idea. it's hard to put a ETA on this, it could take a while.
feel free to clone the repo and make a castable-audio
element.
edit: actually that might make it more difficult because we'd need to add those API's to Media Chrome too
Ideally we should rewrite this package with the remote playback API for both audio and video. https://github.com/muxinc/media-chrome/discussions/654
this should now be quite easy to implement with something like:
import { CustomAudioElement } from 'custom-media-element';
import { CastableMediaMixin } from 'castable-video/castable-mixin.js';
export const CastableAudioElement = globalThis.document
? CastableMediaMixin(CustomAudioElement)
: class {};
if (globalThis.customElements && !globalThis.customElements.get('castable-audio')) {
globalThis.CastableAudioElement = CastableAudioElement;
globalThis.customElements.define('castable-audio', CastableAudioElement);
}