MediaSource: activeSourceBuffers プロパティ
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
activeSourceBuffers
は MediaSource
インターフェイスの読み取り専用プロパティで、sourceBuffers
に含まれる SourceBuffer
オブジェクトのサブセットを含む SourceBufferList
オブジェクトを返します。 これは、選択した動画トラック、有効な音声トラック、および表示/非表示のテキストトラックを提供するオブジェクトのリストです。
値
アクティブな各トラックの SourceBuffer
オブジェクトを含む SourceBufferList
。
例
次のスニペットは、Nick Desaulniers によって書かれた簡単な例に基づいています(ライブで完全なデモを見るか、ソースをダウンロードしてさらに調査してください)。
js
const mediaSource = getMediaSource();
function sourceOpen() {
console.log(mediaSource.readyState); // open
const sourceBuffer = mediaSource.addSourceBuffer(mimeCodec);
fetchAB(assetURL, (buf) => {
sourceBuffer.addEventListener("updateend", () => {
mediaSource.endOfStream();
console.log(mediaSource.activeSourceBuffers);
// 動画プレーヤーでの再生用に選択されているため、
// 上記で追加されたソースバッファーが含まれます。
video.play();
console.log(mediaSource.readyState); // ended
});
sourceBuffer.appendBuffer(buf);
});
}
// …
仕様書
Specification |
---|
Media Source Extensions™ # dom-mediasource-activesourcebuffers |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
activeSourceBuffers |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- Partial support
- Partial support
- No support
- No support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.