-
|
I wonder if it's possible to set a SourceAdapter (for example to get the video from another protocol then http) on a MoviElement to avoid redo the ui and everything, but it look like we go from MoviElement to MoviPlayer and MoviPlayer to Demuxer to set it. I have also try the example to set the src with .src and don't look like to work https://mrujjwalg.github.io/movi-player/api/element.html#src |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 10 replies
-
|
Hey @coco875 — good catch, this wasn't supported. Just added a import type { SourceAdapter } from 'movi-player';
class WebSocketSource implements SourceAdapter {
private pos = 0;
constructor(private url: string, private totalSize: number) {}
async getSize() { return this.totalSize; }
async read(offset: number, length: number): Promise<ArrayBuffer> {
// your protocol here — return the requested byte range
}
seek(offset: number) { this.pos = offset; return offset; }
getPosition() { return this.pos; }
close() { /* cleanup */ }
getKey() { return this.url; }
}
const el = document.querySelector('movi-player');
el.sourceAdapter = new WebSocketSource('wss://…', 12345678);The setter mirrors Re your second point — Will be in the next release. |
Beta Was this translation helpful? Give feedback.
Hey @coco875 — good catch, this wasn't supported. Just added a
sourceAdapterproperty on<movi-player>so you can plug any custom protocol straight into the element without touching MoviPlayer/Demuxer or reimplementing the UI.