Last active: a year ago
Create video stream from ArraryBuffer
useEffect(() => {
(async () => {
const result = await decrypt_from_url(VIDEO_PATH);
if (!ref.current) return;
const video = ref.current;
const source = new MediaSource();
video.src = URL.createObjectURL(source);
source.addEventListener("sourceopen", (e) => {
const target = e.target as MediaSource;
const sourceBuffer = target.addSourceBuffer(mimeCodec);
sourceBuffer.addEventListener("updateend", () => {
target.endOfStream();
});
sourceBuffer.appendBuffer(result);
});
})();
}, []);