VideoPlayer
Description
VideoPlayer
BaseBehaviour是在AR场景中控制VideoPlayer的component。
VideoPlayer
BaseBehaviour可以被添加到任何物体上,视频会在其上播放。
如果要使用自动缩放功能,它应该作为
的子物体存在在场景中。
如果要播放透明视频,你需要设置物体的材质能够显示alpha通道。EasyAR提供了一个简单的样例材质 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 |
---|---|---|
<cite style="margin: 0px; padding: 0px;">None</cite> | <cite style="margin: 0px; padding: 0px;">0</cite> | 不缩放 |
<cite style="margin: 0px; padding: 0px;">Fill</cite> | <cite style="margin: 0px; padding: 0px;">1</cite> | 填充ImageTarget,视频会被缩放到与Imagetarget同样大小。 |
<cite style="margin: 0px; padding: 0px;">Fit</cite> | <cite style="margin: 0px; padding: 0px;">2</cite> | 适配ImageTarget,视频会被缩放到最大可适配到Imagetarget里面的大小。 |
<cite style="margin: 0px; padding: 0px;">FitWidth</cite> | <cite style="margin: 0px; padding: 0px;">3</cite> | 适配ImageTarget的宽度,视频宽度会被设成和Imagetarget的宽度相同,而视频比例不变。 |
<cite style="margin: 0px; padding: 0px;">FitHeight</cite> | <cite style="margin: 0px; padding: 0px;">4</cite> | 适配ImageTarget的高度,视频高度会被设成和Imagetarget的高度相同,而视频比例不变。 |
<colgroup style="margin: 0px; padding: 0px;"><col width="16%" style="margin: 0px; padding: 0px;"><col width="7%" style="margin: 0px; padding: 0px;"><col width="78%" style="margin: 0px; padding: 0px;"></colgroup>
Constant | Value | Description |
---|---|---|
<cite style="margin: 0px; padding: 0px;">None</cite> | <cite style="margin: 0px; padding: 0px;">0</cite> | 不缩放 |
<cite style="margin: 0px; padding: 0px;">Fill</cite> | <cite style="margin: 0px; padding: 0px;">1</cite> | 填充ImageTarget,视频会被缩放到与Imagetarget同样大小。 |
<cite style="margin: 0px; padding: 0px;">Fit</cite> | <cite style="margin: 0px; padding: 0px;">2</cite> | 适配ImageTarget,视频会被缩放到最大可适配到Imagetarget里面的大小。 |
<cite style="margin: 0px; padding: 0px;">FitWidth</cite> | <cite style="margin: 0px; padding: 0px;">3</cite> | 适配ImageTarget的宽度,视频宽度会被设成和Imagetarget的宽度相同,而视频比例不变。 |
<cite style="margin: 0px; padding: 0px;">FitHeight</cite> | <cite style="margin: 0px; padding: 0px;">4</cite> | 适配ImageTarget的高度,视频高度会被设成和Imagetarget的高度相同,而视频比例不变。 |
enum ScalePlane
Constant | Value | Description |
---|---|---|
<cite style="margin: 0px; padding: 0px;">XY</cite> | <cite style="margin: 0px; padding: 0px;">1</cite> | 在XY平面缩放。 |
<cite style="margin: 0px; padding: 0px;">XZ</cite> | <cite style="margin: 0px; padding: 0px;">2</cite> | 在XZ平面缩放。 |
<cite style="margin: 0px; padding: 0px;">YX</cite> | <cite style="margin: 0px; padding: 0px;">4</cite> | 在YX平面缩放。 |
<cite style="margin: 0px; padding: 0px;">YZ</cite> | <cite style="margin: 0px; padding: 0px;">6</cite> | 在YZ平面缩放。 |
<cite style="margin: 0px; padding: 0px;">ZX</cite> | <cite style="margin: 0px; padding: 0px;">8</cite> | 在ZX平面缩放。 |
<cite style="margin: 0px; padding: 0px;">ZY</cite> | <cite style="margin: 0px; padding: 0px;">9</cite> | 在ZY平面缩放。 |
<colgroup style="margin: 0px; padding: 0px;"><col width="43%" style="margin: 0px; padding: 0px;"><col width="19%" style="margin: 0px; padding: 0px;"><col width="38%" style="margin: 0px; padding: 0px;"></colgroup>
Constant | Value | Description |
---|---|---|
<cite style="margin: 0px; padding: 0px;">XY</cite> | <cite style="margin: 0px; padding: 0px;">1</cite> | 在XY平面缩放。 |
<cite style="margin: 0px; padding: 0px;">XZ</cite> | <cite style="margin: 0px; padding: 0px;">2</cite> | 在XZ平面缩放。 |
<cite style="margin: 0px; padding: 0px;">YX</cite> | <cite style="margin: 0px; padding: 0px;">4</cite> | 在YX平面缩放。 |
<cite style="margin: 0px; padding: 0px;">YZ</cite> | <cite style="margin: 0px; padding: 0px;">6</cite> | 在YZ平面缩放。 |
<cite style="margin: 0px; padding: 0px;">ZX</cite> | <cite style="margin: 0px; padding: 0px;">8</cite> | 在ZX平面缩放。 |
<cite style="margin: 0px; padding: 0px;">ZY</cite> | <cite style="margin: 0px; padding: 0px;">9</cite> | 在ZY平面缩放。 |
bool EnableAutoPlay
启用自动播放。如果启用,当视频成功打开之后会自动开始播放。
bool EnableLoop
启用循环播放。如果启用,当视频播放到结束的时候,会自动从头再次播放。
bool OpenWhenStart
在 MonoBehaviour.Start 被调用的时候打开视频。
bool DisplayTextMessage
在不支持的平台上显示不支持的信息。
string Path
视频路径。set操作需要在Open之前调用。详见
。
StorageType Storage
视频存储路径的类型。set操作需要在Open之前调用。详见
。
VideoPlayer
视频类型。set操作需要在Open之前调用。
VideoPlayer
VideoPlayer
。你可以通过Target获得更加高级的控制。详见
。
float VideoScaleFactorBase
视频基础缩放系数。在视频缩放过程中缩放后的视频大小会乘以这个系数。通常你可以对plane设为0.1,其它简单物体设为1。
ScaleMode VideoScaleMode
缩放模式。
ScalePlane VideoScalePlane
缩放平面。物体在这个平面上的大小将被根据缩放模式和ImageTarget的大小自动调整。
float Volume
视频音量。在成功的Open之后使用。
void Open()
打开视频。详细描述参见
[VideoPlayer
.Open](https://www.easyar.cn/doc/EasyAR%20SDK/Unity%20Plugin%20Reference/1.0/VideoPlayer.html#open)
。
void Close()
关闭视频。
bool Play()
开始或继续播放视频。
bool Pause()
暂停视频播放。
bool Stop()
停止视频播放。
bool Seek(int position)
将播放位置调整到 position 。在成功的Open之后使用。
int CurPosition()
返回当前播放到的视频位置。在成功的Open之后使用。
int Duration()
返回视频长度。在成功的Open之后使用。
int Width()
返回视频宽度。在成功的Open之后使用。
int Height()
返回视频高度。在成功的Open之后使用。
event EventHandler VideoErrorEvent
视频打开或播放错误的事件。
event EventHandler VideoReachEndEvent
视频播放结束的事件。
event EventHandler VideoReadyEvent
视频成功打开的事件。在收到这个事件的时候你就可以开始播放视频了。
网友评论