这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
非标
此特征是非标准的,且不在标准轨道中。不要在面向 Web 的生产站点中使用它:它不适用于每个用户。实现之间可能存在大的不兼容性,且行为将来可能改变。
changeType()
方法在
SourceBuffer
interface sets the MIME type that future calls to
appendBuffer()
should expect the new media data to conform to.
This makes it possible to change codecs or container type mid-stream.
One scenario in which this is helpful is to support adapting the media source to changing bandwidth availability, by transitioning from one codec to another as resource constraints change.
sourceBuffer.changeType(type);
type
DOMString
specifying the MIME type that future buffers will conform to.
TypeError
The specified string is empty, rather than indicating a valid MIME type.
InvalidStateError
SourceBuffer
is not a member of the parent media source's
sourceBuffers
list, or the buffer's
updating
property indicates that a previously queued
appendBuffer()
or
remove()
is still being processed.
NotSupportedError
SourceBuffer
objects present in the
MediaSource.sourceBuffers
列表。
If the parent
MediaSource
is in its
"ended"
readyState
,调用
changeType()
will transition the media source to the
"open"
readyState
and fire a simple event named
sourceopen
at the parent media source.
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
changeType
非标
|
Chrome 70 | Edge 79 | Firefox 63 | IE ? | Opera ? | Safari ? | WebView Android 70 | Chrome Android 70 | Firefox Android 不支持 No | Opera Android ? | Safari iOS 不支持 No | Samsung Internet Android 10.0 |
完整支持
不支持
兼容性未知
非标。预期跨浏览器支持较差。
用户必须明确启用此特征。
SourceBuffer