The SourceBuffer
interface represents a chunk of media to be passed into an HTMLMediaElement
and played, via a MediaSource
object. This can be made up of one or several media segments.
Documentation SourceBuffer by Mozilla Contributors, licensed under CC-BY-SA 2.5.
See also:
Variables
appendWindowStart:Float
Controls the timestamp for the start of the append window. This is a timestamp range that can be used to filter what media data is appended to the SourceBuffer
. Coded media frames with timestamps within this range will be appended, whereas those outside the range will be filtered out.
read onlybuffered:TimeRanges
Returns the time ranges that are currently buffered in the SourceBuffer
.
mode:SourceBufferAppendMode
Controls how the order of media segments in the SourceBuffer
is handled, in terms of whether they can be appended in any order, or they have to be kept in a strict sequence.
onabort:Function
Fired whenever SourceBuffer.appendBuffer()
or SourceBuffer.appendStream()
is ended by a call to SourceBuffer.abort()
. SourceBuffer.updating
changes from true
to false
.
onerror:Function
Fired whenever an error occurs during SourceBuffer.appendBuffer()
or SourceBuffer.appendStream()
. SourceBuffer.updating
changes from true
to false
.
onupdate:Function
Fired whenever SourceBuffer.appendBuffer()
method or the SourceBuffer.remove()
completes. SourceBuffer.updating
changes from true
to false
. This event is fired before onupdateend
.
onupdateend:Function
Fired whenever SourceBuffer.appendBuffer()
method or the SourceBuffer.remove()
has ended. This event is fired after onupdate
.
onupdatestart:Function
Fired whenever the value of SourceBuffer.updating
transitions from false
to true
.
timestampOffset:Float
Controls the offset applied to timestamps inside media segments that are subsequently appended to the SourceBuffer
.
read onlyupdating:Bool
A boolean indicating whether the SourceBuffer
is currently being updated — i.e. whether an SourceBuffer.appendBuffer()
, SourceBuffer.appendStream()
, or SourceBuffer.remove()
operation is currently in progress.
Methods
appendBuffer(data:ArrayBufferView):Void
appendBuffer(data:ArrayBuffer):Void
Appends media segment data from an ArrayBuffer
or ArrayBufferView
object to the SourceBuffer
.
Throws:
null | DOMError |
---|
changeType(type:String):Void
Changes the MIME type
that future calls to SourceBuffer.appendBuffer
will expect the new data to conform to.
Throws:
null | DOMError |
---|