VrVideoView

public class VrVideoView

VR View that renders a mono or stereo panorama video (Experimental API).

Nested Classes

class VrVideoView.Options Configure the VrVideoView's parameters for loading videos. 

Inherited Constants

Inherited Fields

Public Constructors

VrVideoView(Context context, AttributeSet attrs)
VrVideoView(Context context)

Public Methods

long
getCurrentPosition()
Gets the current position in the video.
long
getDuration()
Gets the duration of the video.
void
loadVideo(Uri uri, VrVideoView.Options options)
Loads a pano video from the given Uri.
void
loadVideoFromAsset(String filename, VrVideoView.Options options)
Loads a pano video from the given file in the assets of the apk.
void
pauseRendering()
Pauses 3D rendering and tracking.
void
pauseVideo()
Pauses the video if it is playing.
void
playVideo()
Starts playing the video as soon as it is loaded.
void
seekTo(long positionMs)
Seeks to a position in the video.
void
setEventListener(VrVideoEventListener eventListener)
Register a callback to be invoked VrVideoView related events have occurred.
void
setVolume(float volume)
Sets a multiplier to the volume between 0.0f and 1.0f on the media audio playback.

Inherited Methods

Public Constructors

public VrVideoView (Context context, AttributeSet attrs)

Parameters
context Context must be an instance of activity, otherwise a Runtime exception is thrown.
attrs Custom attributes for the view.

public VrVideoView (Context context)

Parameters
context Context must be an instance of activity, otherwise a Runtime exception is thrown.

Public Methods

public long getCurrentPosition ()

Gets the current position in the video.

Returns
  • the current position in milliseconds.

public long getDuration ()

Gets the duration of the video.

Returns
  • the duration in milliseconds.

public void loadVideo (Uri uri, VrVideoView.Options options)

Loads a pano video from the given Uri.

The Uri can be:

  • a file relative to the root of the disk such as "/sdcard/FILENAME.MP4". If the video is part of the apk's assets, loadVideoFromAsset(String, VrVideoView.Options) should be used instead.
  • A remote URL with a http or https scheme, such as "http://foo.com/file.mp4". HLS URLS (e.g. "http://foo.com/file.m3u8") are supported but require the correct input format to be set in the VrVideoView.Options object.

The method may throw an IOException when trying to read a file from disk. Even if this succeeds, the method might indicate and error via onLoadError(String) if there is a failure trying to process the video.

Parameters
uri local or remote path to the video file
options contains additional information about the video. Null will use the default options.
Throws
IOException if there is an error reading the file

public void loadVideoFromAsset (String filename, VrVideoView.Options options)

Loads a pano video from the given file in the assets of the apk. If the video isn't in the assets, the general loadVideo(Uri, VrVideoView.Options) should be used.

The method may throw an IOException when trying to read the file from disk. Even if this succeeds, the method might indicate and error via onLoadError(String) if there is a failure trying to process the video.

Parameters
filename the full path and file name of the video in the apk's assets
options contains additional information about the video. Null will use the default options.
Throws
IOException if there is an error reading the file

public void pauseRendering ()

Pauses 3D rendering and tracking.

This should be called in the activity's onPause() method. This also pauses the video and resumeRendering() will resume rendering tracking but not the video playback. If the app wants to resume playing the video it should call playVideo() when appropriate.

public void pauseVideo ()

Pauses the video if it is playing.

public void playVideo ()

Starts playing the video as soon as it is loaded. Resumes playing a paused video.

public void seekTo (long positionMs)

Seeks to a position in the video.

Parameters
positionMs the position in milliseconds.

public void setEventListener (VrVideoEventListener eventListener)

Register a callback to be invoked VrVideoView related events have occurred.

Parameters
eventListener Receives general VrEventListener events and VrVideoEventListener events.

public void setVolume (float volume)

Sets a multiplier to the volume between 0.0f and 1.0f on the media audio playback. This setting persists across multiple videos. Set to 1.0f by default.

Parameters
volume The volume multiplier. 0.0f means muted, while 1.0f means regular volume.