O3hMediaSource class

A media source object that acts as a producer of video content that can be displayed or recorded.

Signature:

export declare class O3hMediaSource extends ExternalObject 

Extends: ExternalObject

Remarks

To create an instance, use MediaSourceManager.createCameraSource(), MediaSourceManager.createVideoPlayerSource() or .

Methods

MethodModifiersDescription
captureImage(config)Captures the current frame displayed by the media source and returns it as an image asset.
createVideoRecorder(config)Creates a MediaSourceRecorder that can be used to record a video from this media source.
destroy()Destroys this media source and releases any associated resources.
getCurrentSize()Returns the current dimensions of the video content displayed by the media source.
getSizeUpdates()Listens for changes to the size of the video content displayed by the media source.

O3hMediaSource.captureImage() method

Captures the current frame displayed by the media source and returns it as an image asset.

Signature:

captureImage(config?: MediaSourceImageCaptureConfig): Promise<ImageAsset>;

Parameters

ParameterTypeDescription
configMediaSourceImageCaptureConfig(Optional) Determines the size and format of the captured image.

Returns:

Promise<ImageAsset>

A promise that resolves with the image asset when it is ready.

O3hMediaSource.createVideoRecorder() method

Creates a MediaSourceRecorder that can be used to record a video from this media source.

Signature:

createVideoRecorder(config?: MediaSourceRecorderConfig): Promise<MediaSourceRecorder>;

Parameters

ParameterTypeDescription
configMediaSourceRecorderConfig(Optional) The configuration for creating the recorder. If not specified default values will be used for all options.

Returns:

Promise<MediaSourceRecorder>

O3hMediaSource.destroy() method

Destroys this media source and releases any associated resources.

Signature:

destroy(): void;

Returns:

void

Remarks

If this is called and there are any other objects (components, video recorders, filtered sources etc.) that depend on this source, it will not actually by destroyed until those dependent objects are also destroyed. In any case, you cannot call any API methods on this object or use it to create new objects once this is called even if the media source is kept alive by dependent objects.

O3hMediaSource.getCurrentSize() method

Returns the current dimensions of the video content displayed by the media source.

Signature:

getCurrentSize(): Promise<Vector2>;

Returns:

Promise<Vector2>

A promise that resolves with a Vector2 containing the width and height of the media source content in pixels as the x and y values respectively.

O3hMediaSource.getSizeUpdates() method

Listens for changes to the size of the video content displayed by the media source.

Signature:

getSizeUpdates(): Subject<Vector2>;

Returns:

Subject<Vector2>

A Subject that emits the latest size of the media source content when it changes, as a Vector2 with the x and y values being the width and height in pixels.