November 6, 2019 update:
  • There's a new open source Cardboard SDK for iOS and Android NDK that offers a streamlined API, improved device compatibility, and built-in viewer profile QR code scanning. A corresponding Unity package (SDK) is planned for a future release. We recommend that all developers actively building for Google Cardboard migrate (iOS, Android NDK) to the new Cardboard SDK.
October 15, 2019 update:
  • The Daydream View VR headset is no longer available for purchase. However, you can continue to use the existing Google VR SDK to update and distribute your apps to the Google Play Store, and make them available to users in the Daydream app.

GvrVideoPlayerTexture

Plays video using Exoplayer rendering it on the main texture.

Summary

Inheritance

Inherits from: MonoBehaviour

Public types

StereoMode{
  NoValue = -1,
  Mono = 0,
  TopBottom = 1,
  LeftRight = 2
}
enum
Stereo mode formats.
VideoEvents{
  VideoReady = 1,
  VideoStartPlayback = 2,
  VideoFormatChanged = 3,
  VideoSurfaceSet = 4,
  VideoSizeChanged = 5
}
enum
Video events.
VideoPlayerState{
  Idle = 1,
  Preparing = 2,
  Buffering = 3,
  Ready = 4,
  Ended = 5
}
enum
Video player state.
VideoResolution{
  Lowest = 1,
  _720 = 720,
  _1080 = 1080,
  _2048 = 2048,
  Highest = 4096
}
enum
Video resolutions which can be selected as the initial resolution when streaming begins.
VideoType{
  Dash = 0,
  HLS = 2,
  Other = 3
}
enum
Video type.

Public attributes

adjustAspectRatio
bool
Value true indicates that the aspect ratio of the renderer needs adjusting.
initialResolution = VideoResolution.Highest
The video resolution used when streaming begins.
statusText
Text
Attach a text component to get some debug status info.
useSecurePath
bool
Whether to use secure path for DRM protected video.
videoContentID
string
The video content ID.
videoProviderId
string
The video provider ID.
videoType
The type of the video.
videoURL
string
The video URL.

Properties

AspectRatio
float
Gets the aspect ratio of the texture.
BufferedPercentage
int
Gets the buffered percentage of the video stream.
BufferedPosition
long
Gets the buffered position in seconds of the video stream.
CurrentFrameTexture
Texture
Gets the current frame texture.
CurrentPosition
long
Gets or sets the current position in seconds in the video stream.
CurrentStereoMode
Gets the current stereo mode.
CurrentVolume
int
Gets or sets the current volume setting.
HasProjection
bool
Gets a value indicating whether the video has a projection.
Height
int
Gets the height of the texture.
IsPaused
bool
Gets a value indicating whether the video is paused.
MaxVolume
int
Gets the maximum volume value which can be set.
PlayerState
Gets the player state.
Screen
Renderer
Gets or sets the renderer for the video texture.
VideoDuration
long
Gets the duration in seconds of the video stream.
VideoReady
bool
Gets a value indicating whether the video is ready to be played.
Width
int
Gets the width of the texture.

Public functions

CleanupVideo()
void
Cleans up the current video player and texture.
Init()
bool
Initialize the video player.
Pause()
bool
Pauses video playback.
Play()
bool
Play the video.
ReInitializeVideo()
void
Reinitializes the current video player or creates one if there is no player.
RemoveOnVideoEventCallback(Action< int > callback)
void
Removes the callback for exceptions.
RestartVideo()
void
Resets the video player.
SetCurrentVolume(int val)
void
Set the volume level.
SetDisplayTexture(Texture texture)
void
Sets the display texture.
SetOnExceptionCallback(Action< string, string > callback)
void
Sets the callback for exceptions.
SetOnVideoEventCallback(Action< int > callback)
void
Sets the callback for video events.

Public types

StereoMode

 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

 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

 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

 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

 VideoType

Video type.

Properties
Dash

Dynamic Adaptive Streaming over HTTP.

HLS

HTTP Live Streaming.

Other

Another video type.

Public attributes

adjustAspectRatio

bool adjustAspectRatio

Value true indicates that the aspect ratio of the renderer needs adjusting.

initialResolution

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

Text statusText

Attach a text component to get some debug status info.

useSecurePath

bool useSecurePath

Whether to use secure path for DRM protected video.

videoContentID

string videoContentID

The video content ID.

videoProviderId

string videoProviderId

The video provider ID.

videoType

VideoType videoType

The type of the video.

videoURL

string videoURL

The video URL.

Properties

AspectRatio

float AspectRatio

Gets the aspect ratio of the texture.

The aspect ratio of the texture.

BufferedPercentage

int BufferedPercentage

Gets the buffered percentage of the video stream.

The buffered percentage of the video stream.

BufferedPosition

long BufferedPosition

Gets the buffered position in seconds of the video stream.

The buffered position in seconds of the video stream.

CurrentFrameTexture

Texture CurrentFrameTexture

Gets the current frame texture.

The current frame texture.

CurrentPosition

long CurrentPosition

Gets or sets the current position in seconds in the video stream.

The current position in seconds in the video stream.

CurrentStereoMode

StereoMode CurrentStereoMode

Gets the current stereo mode.

The current stereo mode.

CurrentVolume

int CurrentVolume

Gets or sets the current volume setting.

The current volume setting.

HasProjection

bool HasProjection

Gets a value indicating whether the video has a projection.

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

Height

int Height

Gets the height of the texture.

The height of the texture.

IsPaused

bool IsPaused

Gets a value indicating whether the video is paused.

Value true if the video is paused, false otherwise.

MaxVolume

int MaxVolume

Gets the maximum volume value which can be set.

The maximum volume value which can be set.

PlayerState

VideoPlayerState PlayerState

Gets the player state.

The player state.

Screen

Renderer Screen

Gets or sets the renderer for the video texture.

The renderer for the video texture.

VideoDuration

long VideoDuration

Gets the duration in seconds of the video stream.

The duration in seconds of the video stream.

VideoReady

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

int Width

Gets the width of the texture.

The width of the texture.

Public functions

CleanupVideo

void CleanupVideo()

Cleans up the current video player and texture.

Init

bool Init()

Initialize the video player.

Details
Returns
Returns true if successful.

Pause

bool Pause()

Pauses video playback.

Details
Returns
Returns true if the operation is successful, false otherwise.

Play

bool Play()

Play the video.

Details
Returns
Returns true if the video plays successfully, false otherwise.

ReInitializeVideo

void ReInitializeVideo()

Reinitializes the current video player or creates one if there is no player.

RemoveOnVideoEventCallback

void RemoveOnVideoEventCallback(
  Action< int > callback
)

Removes the callback for exceptions.

Details
Parameters
callback
The callback to remove.

RestartVideo

void RestartVideo()

Resets the video player.

SetCurrentVolume

void SetCurrentVolume(
  int val
)

Set the volume level.

Details
Parameters
val
The new volume level.

SetDisplayTexture

void SetDisplayTexture(
  Texture texture
)

Sets the display texture.

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

SetOnExceptionCallback

void SetOnExceptionCallback(
  Action< string, string > callback
)

Sets the callback for exceptions.

Details
Parameters
callback
The callback to set.

SetOnVideoEventCallback

void SetOnVideoEventCallback(
  Action< int > callback
)

Sets the callback for video events.

Details
Parameters
callback
The callback to set for video events.