Skip to content

Add SphericalGLSurfaceView support to PlayerSurface #2619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

MGaetan89
Copy link
Contributor

This change allows PlayerSurface to render video using SphericalGLSurfaceView when specifying the SURFACE_TYPE_SPHERICAL_GL_SURFACE_VIEW type.

The Compose demo has also been updated to include a 360 video example that utilizes this new surface type.

Note

The 360° video used in the video comes from Bitmovin. I've added a link to the page in the demo source code. Let me know if you'd rather use a different video or handle attribution differently.

@MGaetan89 MGaetan89 force-pushed the add_spherical_surface_PlayerSurface branch from a9decfe to 927c95b Compare July 17, 2025 13:40
@MGaetan89 MGaetan89 force-pushed the add_spherical_surface_PlayerSurface branch from 927c95b to 5a66407 Compare July 21, 2025 13:06
@icbaker icbaker requested a review from oceanjules July 22, 2025 08:26
@MGaetan89 MGaetan89 force-pushed the add_spherical_surface_PlayerSurface branch 2 times, most recently from 1a9035a to af01daf Compare July 25, 2025 13:16
@MGaetan89 MGaetan89 force-pushed the add_spherical_surface_PlayerSurface branch 3 times, most recently from 8eda021 to 8182f30 Compare August 5, 2025 13:37
val contentScale = CONTENT_SCALES[currentContentScaleIndex].second

val presentationState = rememberPresentationState(player)
val scaledModifier = Modifier.resizeWithContentScale(contentScale, presentationState.videoSizeDp)

LaunchedEffect(player) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBD: this will be triggered on all the events, even when they are not relevant to localConfiguration. We are considering adding a player.listen(Player.Events, Player.()->Unit) overload that will let you specify the relevant events for the actionable-trailing-lambda. I'll update this comment once I push that.

"https://storage.googleapis.com/exoplayer-test-media-0/shortform_2.mp4" to SURFACE_TYPE_SURFACE_VIEW,
"https://storage.googleapis.com/exoplayer-test-media-1/gen-3/screens/dash-vod-single-segment/video-vp9-360.webm" to SURFACE_TYPE_SURFACE_VIEW,
"https://storage.googleapis.com/exoplayer-test-media-0/shortform_3.mp4" to SURFACE_TYPE_SURFACE_VIEW,
// https://bitmovin.com/demos/vr-360/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: leftover uri

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put this comment to explain where the video comes from.
Should I remove it or clarify it (for example 360 video coming from https://bitmovin.com/demos/vr-360/)?

This change allows `PlayerSurface` to render video using `SphericalGLSurfaceView` when specifying the `SURFACE_TYPE_SPHERICAL_GL_SURFACE_VIEW` type.

The compose demo has also been updated to include a 360 video example that utilizes this new surface type.
@MGaetan89 MGaetan89 force-pushed the add_spherical_surface_PlayerSurface branch from 8182f30 to daa4ae5 Compare August 6, 2025 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants