5. Requirements
Hardware
● Daydream: Daydream-ready phone and a Daydream View
● Cardboard: Android device running Android 4.4 'KitKat' (API 19) or higher and
a Cardboard viewer
Software
● Android Studio version 2.3.3 or higher
● Android SDK 7.1.1 'Nougat' (API 25) or higher
● Google VR SDK for Android version 1.80.0 or higher
5
7. Image Specifications
● png, jpeg, or gif. recommend use jpeg for improved compression.
● Image dimensions should be powers of two (e.g. 2048 or 4096).
● Mono images should be 2:1 aspect ratio (e.g. 4096 x 2048).
● Stereo images should be 1:1 aspect ratio (e.g. 4096 x 4096).
● Image need to be equirectangular format.
7
9. Video specifications
● mp4s encoded with h264.
● Mono videos should be 2:1 aspect ratio.
● Stereo videos should be 1:1 aspect ratio.
● For maximum compatibility and quality.Provide both a monoscopic
1920x1080 video and a stereo video at 2048x2048 or higher.
9
12. How to Use
def vrVersion = "1.80.0"
dependencies {
compile 'com.android.support:appcompat-v7:26.0.0'
compile 'com.android.support:design:26.0.0'
compile "com.google.vr:sdk-base:$vrVersion"
compile "com.google.vr:sdk-audio:$vrVersion"
compile "com.google.vr:sdk-common:$vrVersion"
compile "com.google.vr:sdk-commonwidget:$vrVersion"
compile "com.google.vr:sdk-panowidget:$vrVersion"
compile "com.google.vr:sdk-videowidget:$vrVersion"
}
12
13. VrPanoramaView
Since the image is large we load it asynchronously. (AsyncTask, RxJava, etc.)
Load image from:
1. asset
2. file system (png, jpeg, gif)
3. URL
4. anything can convert to Bitmap
13
vrPanoramaView.loadImageFromBitmap(bitmap, viewOptions);
17. VrVideoView
Load video form:
1. asset
2. file system (mp4, webm, ogg, aac.)
3. MPEG-DASH format (Dynamic Adaptive Streaming over HTTP wiki)
4. HTTP Live Streaming (HLS wiki) format (ts, m3u8)
17
vrVideoView.loadVideoFromAsset(filename, videoOptions);
vrVideoView.loadVideo(uri, videoOptions);
18. VrVideoView.Options
inputFormat
● FORMAT_DEFAULT - In a standalone, non-streaming format using container
formats such as mp4, webm, ogg, aac.
● FORMAT_DASH - MPEG-DASH format. (a kind of adaptive bitrate streaming)
● FORMAT_HLS - HTTP Live Streaming (HLS) format.
inputType
● TYPE_MONO - single equirectangular panorama.
● TYPE_STEREO_OVER_UNDER - two vertically-stacked equirectangular
panoramas.
18