androidx / media

Jetpack Media3 support libraries for media use cases, including ExoPlayer, an extensible media player for Android
https://developer.android.com/media/media3
Apache License 2.0
1.54k stars 373 forks source link

How can I play 360 stereoscopic vr video in ExoPlayer #1564

Closed Sojourner64564 closed 3 weeks ago

Sojourner64564 commented 1 month ago

I need to make app that will use ExoPlayer and play stereoscopic 360 video like herehere . I already did android app with sphericalGLSurfaceView.setDefaultStereoMode(C.STEREO_MODE_LEFT_RIGHT); like it says in this StackOverflow answer but it didn't work. So how do I can do this?

microkatz commented 1 month ago

Hi @Sojourner64564

Here is a blog post depicting how to setup the ExoPlayer demo app to play with spherical videos. https://medium.com/google-exoplayer/playing-360-degree-videos-with-exoplayer-f3b48f8ea390 Hope that provides additional support! Let us know if you have any more questions.

Sojourner64564 commented 1 month ago

Hi, @microkatz Thanks for answer. But this doesn't work because that class (SphericalSurfaceView) doesn't exist. Maybe article outdated, I used class SphericalGLSurfaceView in my project and it works just fine with same result like a in your article.
But I need stereoscopic view this is my main goal. So can I add double views for left and right eyes?

microkatz commented 1 month ago

Ah, apologies @Sojourner64564. The blog is outdated as ExoPlayer removed the sample code for 360 videos in this commit, https://github.com/google/ExoPlayer/commit/73df8e4a260934d9be55e64b0298f21613c7661f.

It seems like though you got the 360 spherical playback working alright?

When I play a 360 video without any changes in the demo app then its plays in the normal surface view looking like two videos on "on top of each other"? I'm not entirely clear on your goal. If you can elaborate further or provide sample code, content, or graphics. If you are trying to split the stream into two views, you can use an Effect, https://medium.com/google-exoplayer/trim-transcode-concatenate-your-guide-to-media3-editing-libraries-668b4e4c2f97, to crop the stream to just one view. Use two Players with two Views to stream the content. You can synchronize the two players by setting one clock to be the other player's clock.

Hopefully that helps!

microkatz commented 3 weeks ago

As there has been no response I am assuming that the provided advice helped! I am going to close this issue. If you have additional questions then feel free to open or create a new issue. Thank you!