This page is a walkthrough of the VR View samples, which can be found in the
/samples directory when you download the Google VR SDK
VR View Sample apps
There are two sample apps which demonstrate the VR View
functionality in the SDK: simplepanowidget and simplevideowidget.
Both of these samples are single activity applications that display an embedded
panoramic image or video using
The simplepanowidget and simplevideowidget samples with their VR Views in embed mode.
They allow the user to view different parts of the panorama by rotating their phone. The simplevideowidget sample also allows the user to pause and play their video by tapping on the VR View, and seek through the video using the slider. The samples expose the fullscreen mode and Cardboard mode buttons in the VR View which allow the user to change modes.
The fullscreen mode is similar to the embed mode but is immersive.
The Cardboard mode allows the user to view the panorama in a Cardboard device like any other Cardboard app.
These two apps also have an additional feature of opening arbitrary panoramas using custom Intents via adb. The syntax for the Intents is documented in the samples' respective Activities, and these Intents can be used to quickly test various media formats.
Overview of the code
A VR View can be included in a layout like any other Android View. This is the
important section of the simplepanowidget
<com.google.vr.sdk.widgets.pano.VrPanoramaView android:id="@+id/pano_view" android:layout_margin="5dip" android:layout_width="match_parent" android:scrollbars="@null" android:layout_height="250dip" />
Inside the Activity, the primary method is
it with a standard Android
Bitmap object and an optional
object. The latter is used to configure the format of the image. The Activity
also implements a
which receives events when the load operation succeeds or fails.
VrPanoramaView requires the caller to load the image and pass in
VrVideoView accepts a file and reads in the
configuration from the file's