androidexoplayervirtual-reality360-virtual-reality

Playing 360 degree split screen videos with ExoPlayer


I'm using ExoPlayer to create an VR video I have a 360 degree video and I did this

<com.google.android.exoplayer2.ui.PlayerView
    android:id="@+id/video_view_player"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:fastforward_increment="15000"
    app:surface_type="spherical_gl_surface_view"
    app:rewind_increment="15000"
    app:controller_layout_id="@layout/content_player_controller"
    android:background="@color/black"
    app:shutter_background_color="@color/black"
    app:show_buffering="always"
    app:show_timeout="3000" />

and in PlayerActivity I setDefaultStereoMode

player?.prepare(mediaSource)
    (player_view.videoSurfaceView as SphericalGLSurfaceView?)!!.setDefaultStereoMode(
        C.STEREO_MODE_MONO
    )

and it shows like this enter image description here

what I need is something like this

enter image description here


Solution

  • Its not clear from your question ion you have done this also, but you do need to set the StereoMode for the player too:

    public static @interface C.StereoMode

    The stereo mode for 360/3D/VR videos. One of Format.NO_VALUE, C.STEREO_MODE_MONO, C.STEREO_MODE_TOP_BOTTOM, C.STEREO_MODE_LEFT_RIGHT or C.STEREO_MODE_STEREO_MESH.

    (https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/C.StereoMode.html)

    You would have something like this in your code:

    player.prepare(videoSource)
            (playerView.videoSurfaceView as SphericalGLSurfaceView?)!!.setDefaultStereoMode(
                C.STEREO_MODE_LEFT_RIGHT
            )