Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The MediaSourceHandle
interface of the Media Source Extensions API is a proxy for a MediaSource
that can be transferred from a dedicated worker back to the main thread and attached to a media element via its HTMLMediaElement.srcObject
property. MediaSource
objects are not transferable because they are event targets, hence the need for MediaSourceHandle
s.
It can be accessed via the MediaSource.handle
property.
Each MediaSource
object created inside a dedicated worker has its own distinct MediaSourceHandle
. The MediaSource.handle
getter will always return the MediaSourceHandle
instance specific to the associated dedicated worker MediaSource
instance. If the handle has already been transferred to the main thread using postMessage()
, the handle instance in the worker is technically detached and can't be transferred again.
Note: This feature is available in Web Workers