Contents

MediaEnvironment

An object that identifies a media playback or streaming environment.

Declaration

struct MediaEnvironment

Overview

To stream media in your browser app, create an instance of MediaEnvironment and call activate() before beginning media playback or capture, for example, by calling the AVCaptureSession class’s makeCaptureSession() method.

To finish media playback or capture, call suspend().

If your app captures media input or prepares streaming content in a rendering extension, call activate() before grantCapability(_:) to grant the media playback and capture capability, which you create with ProcessCapability.mediaPlaybackAndCapture(environment:).

Call createXPCRepresentation() and use XPC to send the media environment to a rendering extension. Additionally, grant the same capability to the web content extension for a page that plays or captures media by calling grantCapability(_:).

Topics

Creating a media environment

Sending media environments over XPC connections

Capturing media streams

See Also

Extension capabilities