activeSourceBuffers
只读特性在
MediaSource
interface returns a
SourceBufferList
object containing a subset of the
SourceBuffer
objects contained within
sourceBuffers
— the list of objects providing the selected video track, enabled audio tracks, and shown/hidden text tracks.
var myActiveSourceBuffers = mediaSource.activeSourceBuffers;
A
SourceBufferList
containing the
SourceBuffer
objects for each of the active tracks.
The following snippet is based on a simple example written by Nick Desaulniers ( view the full demo live ,或 download the source for further investigation.)
function sourceOpen (_) {
//console.log(this.readyState); // open
var mediaSource = this;
var sourceBuffer = mediaSource.addSourceBuffer(mimeCodec);
fetchAB(assetURL, function (buf) {
sourceBuffer.addEventListener('updateend', function (_) {
mediaSource.endOfStream();
console.log(mediaSource.activeSourceBuffers);
// will contain the source buffer that was added above,
// as it is selected for playing in the video player
video.play();
//console.log(mediaSource.readyState); // ended
});
sourceBuffer.appendBuffer(buf);
});
};
...
| 规范 | 状态 | 注释 |
|---|---|---|
|
媒体源扩展
The definition of 'activeSourceBuffers' in that specification. |
推荐 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
activeSourceBuffers
|
Chrome 23 | Edge 12 |
Firefox
42
|
IE 11 | Opera 15 | Safari 8 | WebView Android 4.4.3 | Chrome Android 25 | Firefox Android 41 | Opera Android 14 | Safari iOS 不支持 No | Samsung Internet Android 1.5 |
完整支持
不支持
实验。期望将来行为有所改变。
见实现注意事项。
用户必须明确启用此特征。
MediaSource
activeSourceBuffers
duration
readyState
sourceBuffers