Add SphericalGLSurfaceView support to PlayerSurface#2619
Open
MGaetan89 wants to merge 2 commits intoandroidx:mainfrom
Open
Add SphericalGLSurfaceView support to PlayerSurface#2619MGaetan89 wants to merge 2 commits intoandroidx:mainfrom
SphericalGLSurfaceView support to PlayerSurface#2619MGaetan89 wants to merge 2 commits intoandroidx:mainfrom
Conversation
a9decfe to
927c95b
Compare
927c95b to
5a66407
Compare
1a9035a to
af01daf
Compare
8eda021 to
8182f30
Compare
oceanjules
reviewed
Aug 5, 2025
| val presentationState = rememberPresentationState(player) | ||
| val scaledModifier = Modifier.resizeWithContentScale(contentScale, presentationState.videoSizeDp) | ||
|
|
||
| LaunchedEffect(player) { |
Contributor
There was a problem hiding this comment.
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.
demos/compose/src/main/java/androidx/media3/demo/compose/MainActivity.kt
Show resolved
Hide resolved
| "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/ |
Contributor
Author
There was a problem hiding this comment.
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/)?
libraries/ui_compose/src/main/java/androidx/media3/ui/compose/PlayerSurface.kt
Outdated
Show resolved
Hide resolved
libraries/ui_compose/src/main/java/androidx/media3/ui/compose/PlayerSurface.kt
Show resolved
Hide resolved
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.
8182f30 to
daa4ae5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change allows
PlayerSurfaceto render video usingSphericalGLSurfaceViewwhen specifying theSURFACE_TYPE_SPHERICAL_GL_SURFACE_VIEWtype.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.