Playing 360 degree videos with ExoPlayer
With ExoPlayer 2.9 a new surface type is added to PlayerView
: spherical_view
. This new surface type allows users to view 360º videos without a VR headset. Only some part of the video in one direction is displayed at any time. To explore the video in all directions, a user can drag their finger across the screen or move their mobile device around in different directions.
Try it
You can try spherical view yourself using the ExoPlayer Demo app. At the end of the sample list you can find some 360º video samples we have added. Selecting any of them starts the player using spherical view.
Use it
To use spherical view, you only need to set the surface_type
attribute of your PlayerView to spherical_view
:
Then use ExoPlayer to play a 360º video, as you would any other regular video.
Spherical Video V2 metadata
We’ve also added support for Spherical Video V2 metadata. Spherical Video V2 metadata allows custom projection meshes to be defined (the default one is an equirectangular projection).
Stereo Videos
Many spherical videos are also stereoscopic, meaning one half of every video frame is the left eye view and the other half is the right eye view. Since spherical view can only display one of them, if the video is stereoscopic, only the left eye view is displayed.
If the video contains Spherical Video V2 metadata then it can be automatically detected if the video is stereo or not. If there’s no metadata, the default stereo mode is used. The default stereo mode can be set by:
Limitations
Currently it isn’t possible to switch between regular and 360º videos using the same PlayerView instance.
What’s next
We’re working on a VR player view which will allow using Daydream and Cardboard headsets to view 360º videos.
We’re looking forward to hearing your feedback. Please go to ExoPlayer Github issue tracker for feedback, questions and bugs.