MediaSource: canConstructInDedicatedWorker static property
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
{{APIRef("Media Source Extensions")}}{{AvailableInWorkers("window_and_dedicated")}}
The **canConstructInDedicatedWorker** read-only static property of the {{domxref("MediaSource")}} interface returns true if MediaSource worker support is implemented, providing a low-latency feature detection mechanism.
If this were not available, the alternative would be a much higher latency approach such as attempting the creation of a MediaSource object from a dedicated worker and transferring the result back to the main thread.
Value
A boolean. Returns true if MediaSource worker support is implemented, or false otherwise.
Examples
js
if (MediaSource.canConstructInDedicatedWorker) {
// MSE is available in workers; let's do this
}Specifications
{{Specifications}}
Browser compatibility
{{Compat}}
See also
- MSE-in-Workers Demo by Matt Wolenetz
- {{domxref("Media Source Extensions API", "Media Source Extensions API", "", "nocode")}}
- {{domxref("MediaSource")}}
- {{domxref("SourceBuffer")}}