# GvrVideoPlayerTexture Class Reference

# GvrVideoPlayerTexture

Plays video using Exoplayer rendering it on the main texture.

## Summary

### Inheritance

Inherits from: MonoBehaviour

| ### Public types ||
|---|---|
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a897ccb4837c3245fafb418a0c347934c{ https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a897ccb4837c3245fafb418a0c347934cad50dfcd4fe8be490a6759f4396f6a4c5 = -1, https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a897ccb4837c3245fafb418a0c347934ca5d9b47bd3b65072e0d5daf55f01da086 = 0, https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a897ccb4837c3245fafb418a0c347934cae877fb9a176ab7b69019a542d4844262 = 1, https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a897ccb4837c3245fafb418a0c347934ca955322c98b1fc571e8b6b688ae7d9ee4 = 2 }` | enumStereo mode formats. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a1aad398ea234894f4bc5da2062982de9{ https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a1aad398ea234894f4bc5da2062982de9af3c3321d6dab7c83091b37cff14a284e = 1, https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a1aad398ea234894f4bc5da2062982de9a7e32fbc91336d792d7a7fedc41f2e115 = 2, https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a1aad398ea234894f4bc5da2062982de9a66e84d75493acbc6246344eb5aca2582 = 3, https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a1aad398ea234894f4bc5da2062982de9adf9861a15afe26bd78f412bf602164a8 = 4, https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a1aad398ea234894f4bc5da2062982de9aec22f9316779f210e5b211b008afd8bf = 5 }` | enumVideo events. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a3efb022bba2460d0e063525e978e4bde{ https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a3efb022bba2460d0e063525e978e4bdeae599161956d626eda4cb0a5ffb85271c = 1, https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a3efb022bba2460d0e063525e978e4bdeaad866f19a13c5386d2ec6df246dcbfac = 2, https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a3efb022bba2460d0e063525e978e4bdea1a02d9228df16f3269fffb72e6a4d682 = 3, https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a3efb022bba2460d0e063525e978e4bdeae7d31fc0602fb2ede144d18cdffd816b = 4, https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a3efb022bba2460d0e063525e978e4bdea0157fbb99be9622bdaa6e544270c0622 = 5 }` | enumVideo player state. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a06be8d17f2abd295ed5bfa47065d6c8c{ https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a06be8d17f2abd295ed5bfa47065d6c8cab5b8e20937205384be7b9e0c29a28fdb = 1, https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a06be8d17f2abd295ed5bfa47065d6c8caa32caf2fe157e41ca79e7240c097ac19 = 720, https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a06be8d17f2abd295ed5bfa47065d6c8ca6879a99d5719954b0227ba29a189ae62 = 1080, https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a06be8d17f2abd295ed5bfa47065d6c8caa288c30edfd90a84c18a6305eec310be = 2048, https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a06be8d17f2abd295ed5bfa47065d6c8ca582996407922dab08d5cf2b3d2a7c1c9 = 4096 }` | enumVideo resolutions which can be selected as the initial resolution when streaming begins. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a46858048bb9b96bf2bdf1f431181ae30{ https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a46858048bb9b96bf2bdf1f431181ae30a3663598d5c5858b5a6040b1bbed4f187 = 0, https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a46858048bb9b96bf2bdf1f431181ae30a03688639065c4aa962556d653afbc965 = 2, https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a46858048bb9b96bf2bdf1f431181ae30a6311ae17c1ee52b36e68aaf4ad066387 = 3 }` | enumVideo type. |

| ### Public attributes ||
|---|---|
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a9c8094e6d1d407793bc705abcbc4acf7` | `bool` Value `true` indicates that the aspect ratio of the renderer needs adjusting. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1ac0845d684a79be6e0f09fc468085f650 = VideoResolution.Highest` | `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a06be8d17f2abd295ed5bfa47065d6c8c` The video resolution used when streaming begins. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1abf8c19b8867abeee41b5300e3fc8ae40` | `Text` Attach a text component to get some debug status info. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1ad0f6514e173df357a2991291d54fc13d` | `bool` Whether to use secure path for DRM protected video. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a622f185905b8c1c2c74f4a5139321aef` | `string` The video content ID. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a57ba2b30d1f84526fc8f68af0eeac34c` | `string` The video provider ID. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a99649f41802ecd7b9aa52012a6599120` | `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a46858048bb9b96bf2bdf1f431181ae30` The type of the video. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1ab32743f40078a567df303a4dd7ee396a` | `string` The video URL. |

| ### Properties ||
|---|---|
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a75e7d5ee3313a69db8a5224b13c620f0` | `float` Gets the aspect ratio of the texture. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1ab7f66be62d949df819c67ef12ab26a30` | `int` Gets the buffered percentage of the video stream. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a3bdc5f4e0253870279d11d35ec78a130` | `long` Gets the buffered position in seconds of the video stream. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1ae9785a08f9ef02dc3c66664b190e2f4e` | `Texture` Gets the current frame texture. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1acd7071d3ef03d79ab5ebdb5820a84799` | `long` Gets or sets the current position in seconds in the video stream. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1af96d3435f64492350496b3a2f1684d9e` | `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a897ccb4837c3245fafb418a0c347934c` Gets the current stereo mode. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a15b087bd197db9346a4a8f3d99638e42` | `int` Gets or sets the current volume setting. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a232eb0c0b5b97405b9bcc3accdf71f31` | `bool` Gets a value indicating whether the video has a projection. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a923bd76546a182edbb91b0205e03cc06` | `int` Gets the height of the texture. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1aa4c7b59279dfa2a3256928c158d1c45b` | `bool` Gets a value indicating whether the video is paused. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a88209683cd3dd23eefeab9281a7c5d63` | `int` Gets the maximum volume value which can be set. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a055af6f331093c852fac10f9ad45ffd5` | `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a3efb022bba2460d0e063525e978e4bde` Gets the player state. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a98951fb8e9b4258538a49e168242f2db` | `Renderer` Gets or sets the renderer for the video texture. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a8602a68ed3f6e5ea37d829438d14ceb1` | `long` Gets the duration in seconds of the video stream. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1af51df42af61df19468b77fe7dc02b84b` | `bool` Gets a value indicating whether the video is ready to be played. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a217153927cfd5a20b01dc496848e7365` | `int` Gets the width of the texture. |

| ### Public functions ||
|---|---|
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1af8e40a0b642c53f3da77cb21e3a2b6a5()` | `void` Cleans up the current video player and texture. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1af4a9c95b1331a821feae4089de6e1a90()` | `bool` Initialize the video player. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a3eeaa1ccaa129ec6bc6ef24f9aa7ee86()` | `bool` Pauses video playback. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a2e2ccebb9c2d2a24bfb5b53686a80e88()` | `bool` Play the video. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1ac487e12a48de1ac2fd874d2ffdce73c4()` | `void` Reinitializes the current video player or creates one if there is no player. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a08b3d99bf0f761b20c8518e9e300f969(Action< int > callback)` | `void` Removes the callback for exceptions. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a9853908962885a2d59e0c01613df9526()` | `void` Resets the video player. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1aba92e549efaf331392f05e80bc88fd35(int val)` | `void` Set the volume level. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1ace2d4b62bd8f9062017ea899a2113482(Texture texture)` | `void` Sets the display texture. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a583c956e0a2edb22c041faffa3d3f8dc(Action< string, string > callback)` | `void` Sets the callback for exceptions. |
| `https://developers.google.com/vr/reference/unity/class/GvrVideoPlayerTexture#classGvrVideoPlayerTexture_1a54a81e1f78bc77b0eafee66696e931d9(Action< int > callback)` | `void` Sets the callback for video events. |

## Public types

### StereoMode

```c#
 StereoMode
```
Stereo mode formats.

| Properties ||
|---|---|
| `LeftRight` | Left-and-right stereo sound. |
| `Mono` | Mono sound. |
| `NoValue` | An error-state indicating that no value has been set. |
| `TopBottom` | Top-and-bottom stereo sound. |

### VideoEvents

```c#
 VideoEvents
```
Video events.

| Properties ||
|---|---|
| `VideoFormatChanged` | Indicates that the video format has changed. |
| `VideoReady` | Indicates that video is ready. |
| `VideoSizeChanged` | Indicates that the video size has changed. |
| `VideoStartPlayback` | Indicates that the video playback should begin. |
| `VideoSurfaceSet` | Indicates that the video surface has been set. |

### VideoPlayerState

```c#
 VideoPlayerState
```
Video player state.

| Properties ||
|---|---|
| `Buffering` | Buffering video. |
| `Ended` | Done with video. |
| `Idle` | An idle state. |
| `Preparing` | Preparing for video. |
| `Ready` | Ready for video. |

### VideoResolution

```c#
 VideoResolution
```
Video resolutions which can be selected as the initial resolution when streaming begins.

See `initialResolution` for more information.

| Properties ||
|---|---|
| `Highest` | 4K resolution. |
| `Lowest` | The lowest available resolution. |
| `_1080` | 1080p resolution. |
| `_2048` | 2K resolution. |
| `_720` | 720p resolution. |

### VideoType

```c#
 VideoType
```
Video type.

| Properties ||
|---|---|
| `Dash` | Dynamic Adaptive Streaming over HTTP. |
| `HLS` | HTTP Live Streaming. |
| `Other` | Another video type. |

## Public attributes

### adjustAspectRatio

```c#
bool adjustAspectRatio
```
Value `true` indicates that the aspect ratio of the renderer needs adjusting.

### initialResolution

```c#
VideoResolution initialResolution = VideoResolution.Highest
```
The video resolution used when streaming begins.

For multi-rate streams like Dash and HLS, the stream used at the beginning of playback is selected such that its vertical resolution is greater than or equal to this value.

After streaming begins, the player auto-selects the highest rate stream the network connection is capable of delivering.

### statusText

```c#
Text statusText
```
Attach a text component to get some debug status info.

### useSecurePath

```c#
bool useSecurePath
```
Whether to use secure path for DRM protected video.

### videoContentID

```c#
string videoContentID
```
The video content ID.

### videoProviderId

```c#
string videoProviderId
```
The video provider ID.

### videoType

```c#
VideoType videoType
```
The type of the video.

### videoURL

```c#
string videoURL
```
The video URL.

## Properties

### AspectRatio

```c#
float AspectRatio
```
Gets the aspect ratio of the texture.

The aspect ratio of the texture.

### BufferedPercentage

```c#
int BufferedPercentage
```
Gets the buffered percentage of the video stream.

The buffered percentage of the video stream.

### BufferedPosition

```c#
long BufferedPosition
```
Gets the buffered position in seconds of the video stream.

The buffered position in seconds of the video stream.

### CurrentFrameTexture

```c#
Texture CurrentFrameTexture
```
Gets the current frame texture.

The current frame texture.

### CurrentPosition

```c#
long CurrentPosition
```
Gets or sets the current position in seconds in the video stream.

The current position in seconds in the video stream.

### CurrentStereoMode

```c#
StereoMode CurrentStereoMode
```
Gets the current stereo mode.

The current stereo mode.

### CurrentVolume

```c#
int CurrentVolume
```
Gets or sets the current volume setting.

The current volume setting.

### HasProjection

```c#
bool HasProjection
```
Gets a value indicating whether the video has a projection.

Value `true` if the video has a projection, `false` otherwise.

### Height

```c#
int Height
```
Gets the height of the texture.

The height of the texture.

### IsPaused

```c#
bool IsPaused
```
Gets a value indicating whether the video is paused.

Value `true` if the video is paused, `false` otherwise.

### MaxVolume

```c#
int MaxVolume
```
Gets the maximum volume value which can be set.

The maximum volume value which can be set.

### PlayerState

```c#
VideoPlayerState PlayerState
```
Gets the player state.

The player state.

### Screen

```c#
Renderer Screen
```
Gets or sets the renderer for the video texture.

The renderer for the video texture.

### VideoDuration

```c#
long VideoDuration
```
Gets the duration in seconds of the video stream.

The duration in seconds of the video stream.

### VideoReady

```c#
bool VideoReady
```
Gets a value indicating whether the video is ready to be played.

Value `true` if the video is ready to be played.

### Width

```c#
int Width
```
Gets the width of the texture.

The width of the texture.

## Public functions

### CleanupVideo

```c#
void CleanupVideo()
```
Cleans up the current video player and texture.

### Init

```c#
bool Init()
```
Initialize the video player.

<br />

| Details ||
|---|---|
| **Returns** | Returns `true` if successful. |

### Pause

```c#
bool Pause()
```
Pauses video playback.

<br />

| Details ||
|---|---|
| **Returns** | Returns `true` if the operation is successful, `false` otherwise. |

### Play

```c#
bool Play()
```
Play the video.

<br />

| Details ||
|---|---|
| **Returns** | Returns `true` if the video plays successfully, `false` otherwise. |

### ReInitializeVideo

```c#
void ReInitializeVideo()
```
Reinitializes the current video player or creates one if there is no player.

### RemoveOnVideoEventCallback

```c#
void RemoveOnVideoEventCallback(
  Action< int > callback
)
```
Removes the callback for exceptions.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `callback` | The callback to remove. | |

### RestartVideo

```c#
void RestartVideo()
```
Resets the video player.

### SetCurrentVolume

```c#
void SetCurrentVolume(
  int val
)
```
Set the volume level.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `val` | The new volume level. | |

### SetDisplayTexture

```c#
void SetDisplayTexture(
  Texture texture
)
```
Sets the display texture.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `texture` | Texture to display. If `null`, the initial texture of the renderer is used. | |

### SetOnExceptionCallback

```c#
void SetOnExceptionCallback(
  Action< string, string > callback
)
```
Sets the callback for exceptions.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `callback` | The callback to set. | |

### SetOnVideoEventCallback

```c#
void SetOnVideoEventCallback(
  Action< int > callback
)
```
Sets the callback for video events.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `callback` | The callback to set for video events. | |