Last active
April 9, 2018 11:47
-
-
Save beaufortfrancois/307e3ffbf8c8435b1fab80831e5dd404 to your computer and use it in GitHub Desktop.
MSE promisified
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
// In an ideal world, MSE would be that simple... | |
const mediaSource = new MediaSource() | |
video.srcObject = mediaSource | |
await mediaSource.ready | |
const sourceBuffer = mediaSource.addSourceBuffer('video/mp4') | |
const response = await fetch('https://example.com/init.mp4') | |
const data = await response.arrayBuffer() | |
await sourceBuffer.appendBuffer(data) |
@mounirlamouri Here it is:
interface MediaSource : EventTarget {
readonly attribute Promise<void> ready;
}
interface SourceBuffer : EventTarget {
Promise<void> appendBuffer(BufferSource data);
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Would it make sense to also show the changes in IDL this would require?