2

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

amirhesni
  • 441
  • 1
  • 6
  • 22

1 Answers1

1

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
        )
Mick
  • 24,231
  • 1
  • 54
  • 120
  • 1
    I tried that too it still shows a single player – amirhesni Jul 30 '22 at 09:11
  • A quick check - have you confirmed the video definitely is stereoscopic? – Mick Jul 30 '22 at 20:55
  • Actually I'm not quite sure , I downloaded 360degree video from youtube , do you have a video with correct format ? – amirhesni Aug 01 '22 at 04:43
  • @amirhesni - I don't but you can find some if you search for 'stereoscopic 360 video sample' - e.g.: http://photocreations.ca/3D/index.html – Mick Aug 01 '22 at 13:40
  • This doesn't work. I don't know why this is the accepted answer. Stereo mode left right, just elongates the video and not split the screen into two as shown in the question. @Mick did you try running this answer yourself? – RoyalGriffin Jan 07 '23 at 09:03
  • @RoyalGriffin - It has been a while since I looked at this and it does evolve but this should work (note right left is not supported at the moment). From looking at the latest code the hooks are definitely there - it is dependant on ExoPlayer mp4 atom parser parser detecting that the video is Left Right stereo in the 'Atom.TYPE_st3d' of the video. Are you able to share an example video which does not work and I'll check and test? – Mick Jan 07 '23 at 21:54