Class PlayerView360

All Implemented Interfaces:
Drawable.Callback, AccessibilityEventSource, KeyEvent.Callback, ViewManager, ViewParent, IPlayerView

public class PlayerView360 extends PlayerView
The CastLabs PlayerView360 is a custom view that provides the video playback surface to render 360 degree video.

You can add this view to an activity and access the PlayerController to gain control over the player.

This view can also be used in conjunction with the GvrActivity's GvrActivity.setGvrView(GvrView) method given the getGvrView() method. The default rendering mode for this view is *mono*. If you want to render in stereo mode call setStereoModeEnabled(boolean) with true.

Note that the view needs to react to certain activity lifecycle events to be able to start, stop, and resume playback when the activity is paused or resumed. The underlying PlayerController also needs to be shut down when the hosting activity is destroyed.

The view offers a lifecycle helper class (see PlayerViewLifecycleDelegate) to simplify the integration, but you will need to hook up the events in the hosting activity. For this, overwrite the following methods in the hosting activity and delegate to the lifecycle listener:

  protected void onStart() {

  protected void onResume() {

  protected void onStop() {
Please note that the example above does not deal with background playback. Please take a look at PlayerService to see how to integrate the lifecycle events when you are using a service and want to enable background playback.
  • Constructor Details

  • Method Details

    • onTouchEvent

      public boolean onTouchEvent(MotionEvent e)
      onTouchEvent in class View
    • getGvrView

      public getGvrView()
      Returns the underlying GvrView.

      You can use the return value of this method as an argument for GvrActivity.setGvrView(GvrView).

      the underlying GvrView
    • removeSurface

      public void removeSurface()
      Specified by:
      removeSurface in interface IPlayerView
      removeSurface in class PlayerView
    • getStereoModeEnabled

      public boolean getStereoModeEnabled()
    • setStereoModeEnabled

      public void setStereoModeEnabled(boolean aEnabled)
    • setOnCloseButtonClickListener

      public void setOnCloseButtonClickListener(PlayerView360.OnCloseButtonListener aListener)