Firefox Tomorrow

web api instance method

SourceBuffer: changeType() method

View on MDN ↗

Available in workers

The changeType() method of the 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.

Syntax

changeType(type)

Parameters

  • type
    • : A string specifying the MIME type that future buffers will conform to.

Return value

None (undefined).

Exceptions

Usage notes

If the readyState property of the parent MediaSource is set to "ended", calling changeType() will set the readyState property to "open" and fire an event named sourceopen at the parent media source.

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also