VideoComponent class

Warning: This API is now obsolete.

Create a video media source with MediaSourceManager.createVideoPlayerSource() and use that to create a component for display.

A view of a video file who's playback can be controlled.

Signature:

export declare class VideoComponent extends Component implements ITimer 

Extends: Component

Implements: ITimer

Methods

MethodModifiersDescription
captureImage()Capture a still image from the video at the current time.
getTime()Get the current position of the video, use VideoComponent.getTimeUpdates() if you need this frequently
getTimeUpdates()Get an update every frame when the video's current playback position has changed
getVideoLength()Get the length of the video associated with this component.
pause()Pause video playback.
playVideo()This is the equivalent to calling VideoComponent.start() but returns a promise to track when the video completes playing.
prepareVideo(assetOrUrl)Load the video and wait for it to be ready to be played
reset()Stops video playback and resets the playback position to the start of the video.
resume()Resume video playback if paused.
seekVideo(time)Jump the video to the given time between 0 and VideoComponent.getVideoLength()
setLooping(loop)Control if the video player loops when reaching the end or not
setSpeed(speed)Control the speed at which the video plays, relative to it's normal playback rate.
setTitle(title)Set the title text displayed below the video.
setVolume(volume)Set the volume of the video player.
start()Start playing the video loaded previously with prepareVideo.
stop()Stops the currently playing video.

VideoComponent.captureImage() method

Capture a still image from the video at the current time.

Signature:

captureImage(): Promise<ImageAsset>;

Returns:

Promise<ImageAsset>

A still capture as an image asset

VideoComponent.getTime() method

Get the current position of the video, use VideoComponent.getTimeUpdates() if you need this frequently

Signature:

getTime(): Promise<number>;

Returns:

Promise<number>

The current position of the video in milliseconds

VideoComponent.getTimeUpdates() method

Get an update every frame when the video's current playback position has changed

Signature:

getTimeUpdates(): Subject<number>;

Returns:

Subject<number>

A subject that emits updates to the position of the video in milliseconds

VideoComponent.getVideoLength() method

Get the length of the video associated with this component.

Signature:

getVideoLength(): Promise<number>;

Returns:

Promise<number>

The length of the video in milliseconds.

VideoComponent.pause() method

Pause video playback.

Signature:

pause(): void;

Returns:

void

VideoComponent.playVideo() method

This is the equivalent to calling VideoComponent.start() but returns a promise to track when the video completes playing.

Signature:

playVideo(): Promise<void>;

Returns:

Promise<void>

A promise that resolves when the video playback is complete

VideoComponent.prepareVideo() method

Load the video and wait for it to be ready to be played

Signature:

prepareVideo(assetOrUrl: VideoAsset | string): Promise<void>;

Parameters

ParameterTypeDescription
assetOrUrlVideoAsset | stringA VideoAsset, an absolute URL of a video, or a relative path to a static video delivered with your module (relative to your index.html)

Returns:

Promise<void>

A promise that resolves when the video is loaded and ready to be played

Remarks

Use VideoAsset.getVideoPath() to get the path of a video asset. This call can take more than half a second to run, try to perform this operation behind the scenes.

VideoComponent.reset() method

Stops video playback and resets the playback position to the start of the video.

Signature:

reset(): Promise<void>;

Returns:

Promise<void>

VideoComponent.resume() method

Resume video playback if paused.

Signature:

resume(): void;

Returns:

void

VideoComponent.seekVideo() method

Jump the video to the given time between 0 and VideoComponent.getVideoLength()

Signature:

seekVideo(time: number): Promise<void>;

Parameters

ParameterTypeDescription
timenumberThe video position's time in milliseconds

Returns:

Promise<void>

A promise that resolves when the seek operation is complete

VideoComponent.setLooping() method

Control if the video player loops when reaching the end or not

Signature:

setLooping(loop: boolean): void;

Parameters

ParameterTypeDescription
loopbooleanEnable or disable looping of the video

Returns:

void

VideoComponent.setSpeed() method

Control the speed at which the video plays, relative to it's normal playback rate.

Signature:

setSpeed(speed: number): void;

Parameters

ParameterTypeDescription
speednumberA fraction of 1. ie: 2 plays at twice normal speed and 0.5 half the normal speed

Returns:

void

Remarks

Values larger then 2 or smaller then -2 will cause the video to skip between key frames instead of providing smooth playback.

VideoComponent.setTitle() method

Set the title text displayed below the video.

Signature:

setTitle(title: string): void;

Parameters

ParameterTypeDescription
titlestringVideo title

Returns:

void

VideoComponent.setVolume() method

Set the volume of the video player.

Signature:

setVolume(volume: number): void;

Parameters

ParameterTypeDescription
volumenumberThe desired video playback volume, with values between 0 and 1. Volume defaults to 1 if this isn't called

Returns:

void

VideoComponent.start() method

Start playing the video loaded previously with prepareVideo.

Signature:

start(): void;

Returns:

void

VideoComponent.stop() method

Stops the currently playing video.

Signature:

stop(): void;

Returns:

void