VideoPlayerBaseBehaviour Class

Description

VideoPlayerBaseBehaviour is the component to control VideoPlayer in the AR scene.

A VideoPlayerBaseBehaviour can be added to any object and the Video will be displayed on top of the object.

It should be child or grandchild to an ImageTargetBaseBehaviour to use the auto scale.

To play a transparent video, you need to set the object material to display alpha channel. EasyAR provides a sample material TransparentVideo.mat.

Public Types

enum ScaleMode{None, Fill, Fit, FitWidth, FitHeight}
enum ScalePlane{XY, XZ, YX, YZ, ZX, ZY}

Public Fields

bool EnableAutoPlay
bool EnableLoop
bool OpenWhenStart
bool DisplayTextMessage
string Path
StorageType Storage
VideoPlayer.VideoType Type
VideoPlayer VideoPlayer
float VideoScaleFactorBase
ScaleMode VideoScaleMode
ScalePlane VideoScalePlane

Public Properties

| float | Volume |

Public Functions

void Open()
void Close()
bool Play()
bool Pause()
bool Stop()
bool Seek(int position)
int CurPosition()
int Duration()
int Width()
int Height()

Public Events

event EventHandler VideoErrorEvent
event EventHandler VideoReachEndEvent
event EventHandler VideoReadyEvent

Overwritten MonoBahaviour Functions

protected virtual void Awake()
protected virtual void OnDestroy()
protected virtual void OnDisable()
protected virtual void OnEnable()
protected virtual void Start()
protected virtual void Update()

enum ScaleMode

Constant Value Description
None 0 Do not scale.
Fill 1 Fill the ImageTarget, video will be scaled to the same size of Imagetarget.
Fit 2 Fit the ImageTarget, video will be scaled to max that can fit into the Imagetarget.
FitWidth 3 Fit the ImageTarget width, video width will be set to the same value of Imagetarget width and the video ratio will be kept unchanged.
FitHeight 4 Fit the ImageTarget height, video height will be set to the same value of Imagetarget height and the video ratio will be kept unchanged.

enum ScalePlane

Constant Value Description
XY 1 Scale on XY plane.
XZ 2 Scale on XZ plane.
YX 4 Scale on YX plane.
YZ 6 Scale on YZ plane.
ZX 8 Scale on ZX plane.
ZY 9 Scale on ZY plane.

bool EnableAutoPlay

Enables auto play. If enabled, when video finished open and ready, it will automatically start to play.

bool EnableLoop

Enables loop play. If enabled, when video reach end, it will play again from the start.

bool OpenWhenStart

Open Video when MonoBehaviour.Start

bool DisplayTextMessage

Display unsupport message on platforms that are not supported.

string Path

Video path. The set operation should be called before Open. See StorageType for more details.

StorageType Storage

Video storage type. The set operation should be called before Open. See StorageType for more details.

VideoPlayer.VideoType Type

Video type. The set operation should be called before Open.

VideoPlayer VideoPlayer

The VideoPlayer object. You can reach advanced controls with VideoPlayer. See VideoPlayer for more details.

float VideoScaleFactorBase

The base factor for video scale. It will be multiplied to the scaled size when scale. Normally you can set 0.1 for plane and 1 for other simple objects.

ScaleMode VideoScaleMode

The scale mode.

ScalePlane VideoScalePlane

The plane used for scale. Object size will be adjusted according to the scale mode and ImageTarget size in the plane direction.

float Volume

Current volume. Use after a successful Open.

void Open()

Opens the video. Reference VideoPlayer.Open for more deatils.

void Close()

Closes the video.

bool Play()

Starts or continues to play video.

bool Pause()

Pauses the video playback.

bool Stop()

Stops the video playback.

bool Seek(int position)

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

int CurPosition()

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

int Duration()

Returns the video duration. Use after a successful Open.

int Width()

Returns the video size. Use after a successful Open.

int Height()

Returns the video height. Use after a successful Open.

event EventHandler VideoErrorEvent

Event for video open error and play error.

event EventHandler VideoReachEndEvent

Event when video reaches end.

event EventHandler VideoReadyEvent

Event when video finished open and ready for play. You can start to play when this event triggers.

results matching ""

    No results matching ""