VideoPlayer Class

Inherits: [Base][0]

Description

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

enum PlayerStatus{Error, Ready, Completed}
enum VideoType{Normal, TransparentSideBySide, TransparentTopAndBottom}

Public Properties

float | Volume

Public Functions

VideoPlayer()
void SetRenderTexture(IntPtr id)
void SetVideoType(VideoType type)
void Open(string url, StorageType storageType)
void Close()
bool Play()
bool Stop()
bool Pause()
int Duration()
int CurrentPosition()
bool Seek(int pos)
int Height()
int Width()

Public Events

Action<VideoPlayer, PlayerStatus\>  PlayerStatusChanged

enum PlayerStatus

Constant Value Description
Error -1 Status to indicate something wrong happen in video open or play.
Ready 0 Status to show video finished open and is ready for play.
Completed 1 Status to indicate video finished play and reached the end.

enum VideoType

Constant Value Description
Normal 0 Normal video.
TransparentSideBySide 1 Transparent video, left half is the RGB channel and right half is alpha channel.
TransparentTopAndBottom 2 Transparent video, top half is the RGB channel and bottom half is alpha channel.

VideoPlayer()

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 PlayerStatusChanged

Player event for video ready of finish, and errors.

See PlayerStatus for more details.

results matching ""

    No results matching ""