Getting Started with EasyAR


VideoPlayer is the class for video playback.

EasyAR supports normal videos, transparent videos and streaming videos. The video contents will be rendered into a texture passed into the player through SetRenderTexture.

Public Types

enumPlayerStatus{Error, Ready, Completed}
enumVideoType{Normal, TransparentSideBySide, TransparentTopAndBottom}

Public Properties


Public Functions

voidSetRenderTexture(IntPtr id)
voidSetVideoType(VideoType type)
voidOpen(string url, StorageType storageType)
boolSeek(int pos)

Public Events

Action<VideoPlayer, PlayerStatus>PlayerStatusChanged

enum PlayerStatus

Error-1Status to indicate something wrong happen in video open or play.
Ready0Status to show video finished open and is ready for play.
Completed1Status to indicate video finished play and reached the end.

enum VideoType

Normal0Normal video.
TransparentSideBySide1Transparent video, left half is the RGB channel and right half is alpha channel.
TransparentTopAndBottom2Transparent video, top half is the RGB channel and bottom half is alpha channel.


Creates a VideoPlayer object.

float Volume

Current volume. Use after a successful Open.

void SetRenderTexture(IntPtr id)

Pass the texture to display video into player. It should be set before Open.

void SetVideoType(VideoType type)

Sets the video type. The type will default to normal video if not set manually. It should be called before open.

void Open(string url, StorageType storageType)

Opens a video from url with storageType.

url can be a local video file (path/to/video.mp4) or url (http://www.../.../video.mp4). storageType indicates the type of path. See StorageType for more descriptions of StorageType.

This method is an async method. The open result and the play status while playing will be updated in the action PlayerStatusChanged. You can check if the open finished successfully and start play after a successful one.

void Close()

Closes the video.

bool Play()

Starts or continues to play video.

bool Stop()

Stops the video playback.

bool Pause()

Pauses the video playback.

int Duration()

Returns the video duration. Use after a successful Open.

int CurrentPosition()

Returns the current position of video. Use after a successful Open.

bool Seek(int pos)

Seek to play to position. Use after a successful Open.

int Height()

Returns the video height. Use after a successful Open.

int width()

Returns the video size. Use after a successful Open.

event Action<VideoPlayer, PlayerStatus> PlayerStatusChanged

Player event for video ready of finish, and errors.

See PlayerStatus for more details.