B4A Library Google VR

This library wraps the 'pano' and 'video' packages from the Google VR for Android API.
Enabling you to display mono and stereo 360° VR images and videos in your projects.

Look at the VrPanoramaView and VrVideoView objects, these are the View objects you'll use in your project.
Each View has a similarly named Options object that along with the VrWidgetViewDisplayMode object contain constants and configurations values required by various library methods.

GoogleVr
Version:
1.20
  • VrConstants
    Fields:
    • VrPanoramaViewOptions As VrPanoramaViewOptions
    • VrVideoViewOptions As VrVideoViewOptions
    • VrWidgetViewDisplayMode As VrWidgetViewDisplayMode
  • VrPanoramaView
    Events:
    • Click
    • DisplayModeChanged (NewDisplayMode As Int)
    • LoadError (ErrorMessage As String)
    • LoadSuccess
    Fields:
    • GRAVITY_BOTTOM As Int
    • GRAVITY_CENTER As Int
    • GRAVITY_CENTER_HORIZONTAL As Int
    • GRAVITY_CENTER_VERTICAL As Int
    • GRAVITY_FILL As Int
    • GRAVITY_FILL_HORIZONTAL As Int
    • GRAVITY_FILL_VERTICAL As Int
    • GRAVITY_LEFT As Int
    • GRAVITY_NO_GRAVITY As Int
    • GRAVITY_RIGHT As Int
    • GRAVITY_TOP As Int
    • ba As BA
    Methods:
    • AddView (View As View, Width As Int, Height As Int, Gravity As Int)
    • BringToFront
    • GetAllViewsRecursive As IterableList
    • GetHeadRotation (YawAndPitch() As Float)
      Provides yaw and pitch angles corresponding to where the user is looking.

      yaw is the rotation along the vertical (y) axis.
      Values are in the [-180, 180] range where:
      • 0 - looking straight at the initial image orientation.
      • 90 - looking 90 degrees to the right.
      • -90 - looking 90 degrees to the left.
      • -180 or 180 - looking in the direction opposite to the initial one

      pitch is the rotation along the right (x) axis previously rotated by yaw.
      Values are in the [-90, 90] range where:
      • 0 - looking straight, level with the ground.
      • 90 - looking up
      • -90 - looking down

      When pitch approaches 90 or -90, yaw values are reset to zero as computing the yaw values becomes numerically unstable.
    • GetView (Index As Int) As ConcreteViewWrapper
    • Initialize
      Initialize the VrWidgetView.
    • Initialize2 (EventName As String)
      Initialize the VrWidgetView and set an event listener.
      (Shortcut for calling Initialize then SetEventListener methods).
    • Invalidate
    • Invalidate2 (arg0 As Rect)
    • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • IsInitialized As Boolean
    • LoadImageFromBitmap (Bitmap1 As Bitmap, InputType As Int)
      Asynchronously loads a pano image using the given bitmap.
      The image to load should be encoded in ARGB_8888 or RGB_565 format.
      See format description at android.graphics.Bitmap.Config
      Event LoadError or LoadSuccess will be raised.
    • PauseRendering
      Pauses 3D rendering and tracking.
      This should be called in the activity's onPause() method.
    • RemoveAllViews
    • RemoveView
    • RemoveViewAt (Index As Int)
    • RequestFocus As Boolean
    • ResumeRendering
      Resumes 3D rendering and tracking.
      This should be called in the activity's onResume() method.
    • SendToBack
    • SetBackgroundImage (arg0 As Bitmap)
    • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
    • SetElevationAnimated (Duration As Int, Elevation As Float)
    • SetEventListener (EventName As String)
      Set an event listener.
      Events raised:
      Click - Called when the view has been clicked.
      DisplayModeChanged - Called when the view's display mode has changed.
      LoadError - There was an error when loading the resource.
      LoadSuccess - The resource was successfully loaded and rendering has started.
      Pass Null to clear an existing event listener.
    • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
    • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    • Shutdown
      Shuts rendering down and releases associated memory.
      Make sure you call this method before the activity is destroyed to reclaim memory. This can be typically called in the activity's onDestroy() method.
      PauseRendering() must be called prior to this function.
      The View should not be used anymore after this method has been called.
    Properties:
    • Background As Drawable
    • Color As Int [write only]
    • Constants As VrConstants [read only]
      Returns the VrConstants object.
    • DisplayMode As Int
      Get or Set the widget's DisplayMode.
      Use the VrWidgetViewDisplayMode constants to set this value.
    • Elevation As Float
    • Enabled As Boolean
    • FullscreenButtonEnabled As Boolean [write only]
      Shows or hides the button to transition to fullscreen mode.
      This button is visible by default whenever the View is in embedded or in stereo mode.
    • Height As Int
    • InfoButtonEnabled As Boolean [write only]
      Shows or hides the show info button.
      The button is visible by default.
    • Left As Int
    • NumberOfViews As Int [read only]
    • Padding()() As Int
    • Parent As Object [read only]
    • StereoModeButtonEnabled As Boolean [write only]
      Shows or hides the button to transition to stereo mode.
      This button is visible by default whenever the View is in embedded or fullscreen mode.
      This button will never be shown on phones which don't have the necessary sensors for stereo mode -- i.e. a gyroscope and accelerometer.
    • Tag As Object
    • Top As Int
    • TouchTrackingEnabled As Boolean [write only]
      Enables or disabled tracking of the view via touch gestures. Only the heading angle can be controlled by touch. This is true by default.
      Regardless of how this is set, touch tracking will be inactive in fullscreen stereo mode.
    • Visible As Boolean
    • Width As Int
  • VrPanoramaViewOptions
    Fields:
    • TYPE_MONO As Int
    • TYPE_STEREO_OVER_UNDER As Int
  • VrVideoView
    Events:
    • Click
    • Completion
    • DisplayModeChanged (NewDisplayMode As Int)
    • LoadError (ErrorMessage As String)
    • LoadSuccess
    • NewFrame
    Fields:
    • GRAVITY_BOTTOM As Int
    • GRAVITY_CENTER As Int
    • GRAVITY_CENTER_HORIZONTAL As Int
    • GRAVITY_CENTER_VERTICAL As Int
    • GRAVITY_FILL As Int
    • GRAVITY_FILL_HORIZONTAL As Int
    • GRAVITY_FILL_VERTICAL As Int
    • GRAVITY_LEFT As Int
    • GRAVITY_NO_GRAVITY As Int
    • GRAVITY_RIGHT As Int
    • GRAVITY_TOP As Int
    • ba As BA
    Methods:
    • AddView (View As View, Width As Int, Height As Int, Gravity As Int)
    • BringToFront
    • GetAllViewsRecursive As IterableList
    • GetHeadRotation (YawAndPitch() As Float)
      Provides yaw and pitch angles corresponding to where the user is looking.

      yaw is the rotation along the vertical (y) axis.
      Values are in the [-180, 180] range where:
      • 0 - looking straight at the initial image orientation.
      • 90 - looking 90 degrees to the right.
      • -90 - looking 90 degrees to the left.
      • -180 or 180 - looking in the direction opposite to the initial one

      pitch is the rotation along the right (x) axis previously rotated by yaw.
      Values are in the [-90, 90] range where:
      • 0 - looking straight, level with the ground.
      • 90 - looking up
      • -90 - looking down

      When pitch approaches 90 or -90, yaw values are reset to zero as computing the yaw values becomes numerically unstable.
    • GetView (Index As Int) As ConcreteViewWrapper
    • Initialize
      Initialize the VrWidgetView.
    • Initialize2 (EventName As String)
      Initialize the VrWidgetView and set an event listener.
      (Shortcut for calling Initialize then SetEventListener methods).
    • Invalidate
    • Invalidate2 (arg0 As Rect)
    • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • IsInitialized As Boolean
    • LoadVideo (Path As String, VideoFormat As Int, VideoType As Int)
      Asynchronously loads a pano video from the given Path.
      The Path can be a path to a local file or a remote URL with an <i>http</i> or <i>https</i> scheme.
      VideoFormat and VideoType are constants from the VrVideoViewOptions object.
      Event LoadError or LoadSuccess will be raised.
    • LoadVideoFromAsset (Path As String, VideoFormat As Int, VideoType As Int)
      Asynchronously loads a pano video from the given file in the assets of the apk.
      If the video isn't located the assets, the general LoadVideo(Path As String, VideoFormat As Int, VideoType As Int) method should be used.
      VideoFormat and VideoType are constants from the VrVideoViewOptions object.
      Event LoadError or LoadSuccess will be raised.
    • 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.
    • PauseVideo
      Pauses the video if it is playing.
    • PlayVideo
      Starts playing the video as soon as it is loaded.
      Resumes playing a paused video.
    • RemoveAllViews
    • RemoveView
    • RemoveViewAt (Index As Int)
    • RequestFocus As Boolean
    • ResumeRendering
      Resumes 3D rendering and tracking.
      This should be called in the activity's onResume() method.
    • SeekTo (PositionMillis As Long)
      Seeks to a position in the video.
    • SendToBack
    • SetBackgroundImage (arg0 As Bitmap)
    • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
    • SetElevationAnimated (Duration As Int, Elevation As Float)
    • SetEventListener (EventName As String)
      Set an event listener.
      Events raised:
      Click - Called when the view has been clicked.
      Completion - The video has finished playing.
      DisplayModeChanged - Called when the view's display mode has changed.
      LoadError - There was an error when loading the resource.
      LoadSuccess - The resource was successfully loaded and rendering has started.
      NewFrame - A new frame has been drawn to the screen.
      Pass Null to clear an existing event listener.
    • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
    • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    • SetVolume (Volume As Float)
      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.
      TODO do not use - method not found!
    • Shutdown
      Shuts rendering down and releases associated memory.
      Make sure you call this method before the activity is destroyed to reclaim memory. This can be typically called in the activity's onDestroy() method.
      PauseRendering() must be called prior to this function.
      The View should not be used anymore after this method has been called.
    Permissions:
    • android.permission.INTERNET
    • android.permission.READ_EXTERNAL_STORAGE
    Properties:
    • Background As Drawable
    • Color As Int [write only]
    • Constants As VrConstants [read only]
      Returns the VrConstants object.
    • CurrentPosition As Long [read only]
      Gets the current position in the video.
      Returns the current position in milliseconds.
    • DisplayMode As Int
      Get or Set the widget's DisplayMode.
      Use the VrWidgetViewDisplayMode constants to set this value.
    • Duration As Long [read only]
      Gets the duration of the video.
      Returns the duration in milliseconds.
    • Elevation As Float
    • Enabled As Boolean
    • FullscreenButtonEnabled As Boolean [write only]
      Shows or hides the button to transition to fullscreen mode.
      This button is visible by default whenever the View is in embedded or in stereo mode.
    • Height As Int
    • InfoButtonEnabled As Boolean [write only]
      Shows or hides the show info button.
      The button is visible by default.
    • Left As Int
    • NumberOfViews As Int [read only]
    • Padding()() As Int
    • Parent As Object [read only]
    • StereoModeButtonEnabled As Boolean [write only]
      Shows or hides the button to transition to stereo mode.
      This button is visible by default whenever the View is in embedded or fullscreen mode.
      This button will never be shown on phones which don't have the necessary sensors for stereo mode -- i.e. a gyroscope and accelerometer.
    • Tag As Object
    • Top As Int
    • TouchTrackingEnabled As Boolean [write only]
      Enables or disabled tracking of the view via touch gestures. Only the heading angle can be controlled by touch. This is true by default.
      Regardless of how this is set, touch tracking will be inactive in fullscreen stereo mode.
    • Visible As Boolean
    • Width As Int
  • VrVideoViewOptions
    Fields:
    • FORMAT_DEFAULT As Int
    • FORMAT_HLS As Int
    • TYPE_MONO As Int
    • TYPE_STEREO_OVER_UNDER As Int
  • VrWidgetViewDisplayMode
    Fields:
    • EMBEDDED As Int
    • FULLSCREEN_MONO As Int
    • FULLSCREEN_STEREO As Int

A minimum android API level of 21 is required in order to use this library.
The library also depends on 4 .aar format libraries from Google:
  • common.aar
  • commonwidget.aar
  • panowidget.aar
  • videowidget.aar
These are included in the Google VR library and (java) demo available at:
https://developers.google.com/vr/android/download.
Look in the libraries folder in the download for the .aar files and then copy them across to your b4a additional libraries folder.

There have been problem with users not downloading the current latest version of the Google VR .aar files (more info HERE).
So the 4 .aar files you require can be downloaded from Google_VR_aar_libs_20170130.zip.
These .aar files are currently version 1.10.0
I'll post a simple example next...

Library files are over 1MB in size so cannot be attached to this post. Instead download them from HERE.
 
Last edited:

mike1967

Active Member
Licensed User
Longtime User
This library wraps the 'pano' and 'video' packages from the Google VR for Android API.
Enabling you to display mono and stereo 360° VR images and videos in your projects.

Look at the VrPanoramaView and VrVideoView objects, these are the View objects you'll use in your project.
Each View has a similarly named Options object that along with the VrWidgetViewDisplayMode object contain constants and configurations values required by various library methods.

GoogleVr
Version:
1.20
  • VrConstants
    Fields:
    • VrPanoramaViewOptions As VrPanoramaViewOptions
    • VrVideoViewOptions As VrVideoViewOptions
    • VrWidgetViewDisplayMode As VrWidgetViewDisplayMode
  • VrPanoramaView
    Events:
    • Click
    • DisplayModeChanged (NewDisplayMode As Int)
    • LoadError (ErrorMessage As String)
    • LoadSuccess
  • Fields:
    • GRAVITY_BOTTOM As Int
    • GRAVITY_CENTER As Int
    • GRAVITY_CENTER_HORIZONTAL As Int
    • GRAVITY_CENTER_VERTICAL As Int
    • GRAVITY_FILL As Int
    • GRAVITY_FILL_HORIZONTAL As Int
    • GRAVITY_FILL_VERTICAL As Int
    • GRAVITY_LEFT As Int
    • GRAVITY_NO_GRAVITY As Int
    • GRAVITY_RIGHT As Int
    • GRAVITY_TOP As Int
    • ba As BA
  • Methods:
    • AddView (View As View, Width As Int, Height As Int, Gravity As Int)
    • BringToFront
    • GetAllViewsRecursive As IterableList
    • GetHeadRotation (YawAndPitch() As Float)
      Provides yaw and pitch angles corresponding to where the user is looking.

      yaw is the rotation along the vertical (y) axis.
      Values are in the [-180, 180] range where:
      • 0 - looking straight at the initial image orientation.
      • 90 - looking 90 degrees to the right.
      • -90 - looking 90 degrees to the left.
      • -180 or 180 - looking in the direction opposite to the initial one

      pitch is the rotation along the right (x) axis previously rotated by yaw.
      Values are in the [-90, 90] range where:
      • 0 - looking straight, level with the ground.
      • 90 - looking up
      • -90 - looking down

      When pitch approaches 90 or -90, yaw values are reset to zero as computing the yaw values becomes numerically unstable.
    • GetView (Index As Int) As ConcreteViewWrapper
    • Initialize
      Initialize the VrWidgetView.
    • Initialize2 (EventName As String)
      Initialize the VrWidgetView and set an event listener.
      (Shortcut for calling Initialize then SetEventListener methods).
    • Invalidate
    • Invalidate2 (arg0 As Rect)
    • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • IsInitialized As Boolean
    • LoadImageFromBitmap (Bitmap1 As Bitmap, InputType As Int)
      Asynchronously loads a pano image using the given bitmap.
      The image to load should be encoded in ARGB_8888 or RGB_565 format.
      See format description at android.graphics.Bitmap.Config
      Event LoadError or LoadSuccess will be raised.
    • PauseRendering
      Pauses 3D rendering and tracking.
      This should be called in the activity's onPause() method.
    • RemoveAllViews
    • RemoveView
    • RemoveViewAt (Index As Int)
    • RequestFocus As Boolean
    • ResumeRendering
      Resumes 3D rendering and tracking.
      This should be called in the activity's onResume() method.
    • SendToBack
    • SetBackgroundImage (arg0 As Bitmap)
    • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
    • SetElevationAnimated (Duration As Int, Elevation As Float)
    • SetEventListener (EventName As String)
      Set an event listener.
      Events raised:
      Click - Called when the view has been clicked.
      DisplayModeChanged - Called when the view's display mode has changed.
      LoadError - There was an error when loading the resource.
      LoadSuccess - The resource was successfully loaded and rendering has started.
      Pass Null to clear an existing event listener.
    • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
    • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    • Shutdown
      Shuts rendering down and releases associated memory.
      Make sure you call this method before the activity is destroyed to reclaim memory. This can be typically called in the activity's onDestroy() method.
      PauseRendering() must be called prior to this function.
      The View should not be used anymore after this method has been called.
  • Properties:
    • Background As Drawable
    • Color As Int [write only]
    • Constants As VrConstants [read only]
      Returns the VrConstants object.
    • DisplayMode As Int
      Get or Set the widget's DisplayMode.
      Use the VrWidgetViewDisplayMode constants to set this value.
    • Elevation As Float
    • Enabled As Boolean
    • FullscreenButtonEnabled As Boolean [write only]
      Shows or hides the button to transition to fullscreen mode.
      This button is visible by default whenever the View is in embedded or in stereo mode.
    • Height As Int
    • InfoButtonEnabled As Boolean [write only]
      Shows or hides the show info button.
      The button is visible by default.
    • Left As Int
    • NumberOfViews As Int [read only]
    • Padding()() As Int
    • Parent As Object [read only]
    • StereoModeButtonEnabled As Boolean [write only]
      Shows or hides the button to transition to stereo mode.
      This button is visible by default whenever the View is in embedded or fullscreen mode.
      This button will never be shown on phones which don't have the necessary sensors for stereo mode -- i.e. a gyroscope and accelerometer.
    • Tag As Object
    • Top As Int
    • TouchTrackingEnabled As Boolean [write only]
      Enables or disabled tracking of the view via touch gestures. Only the heading angle can be controlled by touch. This is true by default.
      Regardless of how this is set, touch tracking will be inactive in fullscreen stereo mode.
    • Visible As Boolean
    • Width As Int
  • VrPanoramaViewOptions
    Fields:
    • TYPE_MONO As Int
    • TYPE_STEREO_OVER_UNDER As Int
  • VrVideoView
    Events:
    • Click
    • Completion
    • DisplayModeChanged (NewDisplayMode As Int)
    • LoadError (ErrorMessage As String)
    • LoadSuccess
    • NewFrame
  • Fields:
    • GRAVITY_BOTTOM As Int
    • GRAVITY_CENTER As Int
    • GRAVITY_CENTER_HORIZONTAL As Int
    • GRAVITY_CENTER_VERTICAL As Int
    • GRAVITY_FILL As Int
    • GRAVITY_FILL_HORIZONTAL As Int
    • GRAVITY_FILL_VERTICAL As Int
    • GRAVITY_LEFT As Int
    • GRAVITY_NO_GRAVITY As Int
    • GRAVITY_RIGHT As Int
    • GRAVITY_TOP As Int
    • ba As BA
  • Methods:
    • AddView (View As View, Width As Int, Height As Int, Gravity As Int)
    • BringToFront
    • GetAllViewsRecursive As IterableList
    • GetHeadRotation (YawAndPitch() As Float)
      Provides yaw and pitch angles corresponding to where the user is looking.

      yaw is the rotation along the vertical (y) axis.
      Values are in the [-180, 180] range where:
      • 0 - looking straight at the initial image orientation.
      • 90 - looking 90 degrees to the right.
      • -90 - looking 90 degrees to the left.
      • -180 or 180 - looking in the direction opposite to the initial one

      pitch is the rotation along the right (x) axis previously rotated by yaw.
      Values are in the [-90, 90] range where:
      • 0 - looking straight, level with the ground.
      • 90 - looking up
      • -90 - looking down

      When pitch approaches 90 or -90, yaw values are reset to zero as computing the yaw values becomes numerically unstable.
    • GetView (Index As Int) As ConcreteViewWrapper
    • Initialize
      Initialize the VrWidgetView.
    • Initialize2 (EventName As String)
      Initialize the VrWidgetView and set an event listener.
      (Shortcut for calling Initialize then SetEventListener methods).
    • Invalidate
    • Invalidate2 (arg0 As Rect)
    • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • IsInitialized As Boolean
    • LoadVideo (Path As String, VideoFormat As Int, VideoType As Int)
      Asynchronously loads a pano video from the given Path.
      The Path can be a path to a local file or a remote URL with an <i>http</i> or <i>https</i> scheme.
      VideoFormat and VideoType are constants from the VrVideoViewOptions object.
      Event LoadError or LoadSuccess will be raised.
    • LoadVideoFromAsset (Path As String, VideoFormat As Int, VideoType As Int)
      Asynchronously loads a pano video from the given file in the assets of the apk.
      If the video isn't located the assets, the general LoadVideo(Path As String, VideoFormat As Int, VideoType As Int) method should be used.
      VideoFormat and VideoType are constants from the VrVideoViewOptions object.
      Event LoadError or LoadSuccess will be raised.
    • 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.
    • PauseVideo
      Pauses the video if it is playing.
    • PlayVideo
      Starts playing the video as soon as it is loaded.
      Resumes playing a paused video.
    • RemoveAllViews
    • RemoveView
    • RemoveViewAt (Index As Int)
    • RequestFocus As Boolean
    • ResumeRendering
      Resumes 3D rendering and tracking.
      This should be called in the activity's onResume() method.
    • SeekTo (PositionMillis As Long)
      Seeks to a position in the video.
    • SendToBack
    • SetBackgroundImage (arg0 As Bitmap)
    • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
    • SetElevationAnimated (Duration As Int, Elevation As Float)
    • SetEventListener (EventName As String)
      Set an event listener.
      Events raised:
      Click - Called when the view has been clicked.
      Completion - The video has finished playing.
      DisplayModeChanged - Called when the view's display mode has changed.
      LoadError - There was an error when loading the resource.
      LoadSuccess - The resource was successfully loaded and rendering has started.
      NewFrame - A new frame has been drawn to the screen.
      Pass Null to clear an existing event listener.
    • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
    • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    • SetVolume (Volume As Float)
      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.
      TODO do not use - method not found!
    • Shutdown
      Shuts rendering down and releases associated memory.
      Make sure you call this method before the activity is destroyed to reclaim memory. This can be typically called in the activity's onDestroy() method.
      PauseRendering() must be called prior to this function.
      The View should not be used anymore after this method has been called.
  • Permissions:
    • android.permission.INTERNET
    • android.permission.READ_EXTERNAL_STORAGE
  • Properties:
    • Background As Drawable
    • Color As Int [write only]
    • Constants As VrConstants [read only]
      Returns the VrConstants object.
    • CurrentPosition As Long [read only]
      Gets the current position in the video.
      Returns the current position in milliseconds.
    • DisplayMode As Int
      Get or Set the widget's DisplayMode.
      Use the VrWidgetViewDisplayMode constants to set this value.
    • Duration As Long [read only]
      Gets the duration of the video.
      Returns the duration in milliseconds.
    • Elevation As Float
    • Enabled As Boolean
    • FullscreenButtonEnabled As Boolean [write only]
      Shows or hides the button to transition to fullscreen mode.
      This button is visible by default whenever the View is in embedded or in stereo mode.
    • Height As Int
    • InfoButtonEnabled As Boolean [write only]
      Shows or hides the show info button.
      The button is visible by default.
    • Left As Int
    • NumberOfViews As Int [read only]
    • Padding()() As Int
    • Parent As Object [read only]
    • StereoModeButtonEnabled As Boolean [write only]
      Shows or hides the button to transition to stereo mode.
      This button is visible by default whenever the View is in embedded or fullscreen mode.
      This button will never be shown on phones which don't have the necessary sensors for stereo mode -- i.e. a gyroscope and accelerometer.
    • Tag As Object
    • Top As Int
    • TouchTrackingEnabled As Boolean [write only]
      Enables or disabled tracking of the view via touch gestures. Only the heading angle can be controlled by touch. This is true by default.
      Regardless of how this is set, touch tracking will be inactive in fullscreen stereo mode.
    • Visible As Boolean
    • Width As Int
  • VrVideoViewOptions
    Fields:
    • FORMAT_DEFAULT As Int
    • FORMAT_HLS As Int
    • TYPE_MONO As Int
    • TYPE_STEREO_OVER_UNDER As Int
  • VrWidgetViewDisplayMode
    Fields:
    • EMBEDDED As Int
    • FULLSCREEN_MONO As Int
    • FULLSCREEN_STEREO As Int

A minimum android API level of 21 is required in order to use this library.
The library also depends on 4 .aar format libraries from Google:
  • common.aar
  • commonwidget.aar
  • panowidget.aar
  • videowidget.aar
These are included in the Google VR library and (java) demo available at:
https://developers.google.com/vr/android/download.
Look in the libraries folder in the download for the .aar files and then copy them across to your b4a additional libraries folder.

There have been problem with users not downloading the current latest version of the Google VR .aar files (more info HERE).
So the 4 .aar files you require can be downloaded from Google_VR_aar_libs_20170130.zip.
These .aar files are currently version 1.10.0
I'll post a simple example next...

Library files are over 1MB in size so cannot be attached to this post. Instead download them from HERE.

Hello, is possible with this library add Hotspot for info and Navigation ( eg. for create virtual tour) ? How i do ? Thanks in advance
 
Hi Warwound
First of all, thank you very much for the library.
But I am with a problem. I have tested the example on devices that have a gyroscope and accelerometer and they work great.
But there are also other devices with only an accelerometer, proving that the image cannot be moved correctly with the finger, and when it is refreshed, alternating from fullscreen mode in another space, it manages to change the point of view.
Could you please tell me how to make controls that allow finger scrolling?
Best regards
 

Emid

Member
Great project, good job,

I'm using this library to add movement and walking, but don't know how to use tis library,
Do you have any sample code for play 360 degree stereo movie and be can to walking it?

Best regards.
 
Top