How to init StyledPlayerView with isFullScreen == false?
- Dominant language
- Java
- Stars
- 21.9k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
I'm using Jetpack compose to implement a video-streaming app. And I want this app can support toggling full screen and vice versa. I can register ```setControllerOnFullScreenModeChangedListener``` to let fullscreen button visible to user. However when screen rotation from portrait to landscape, the ```AndroidView``` (a composable in Jetpack compose) recomposed and StyledPlayer recreated. This recreation behavior cause ```isFullScreen``` variable reset to false. Therefore I got a fullscreen button in Landscape mode.
Here is my simple Jetpack compose implementation
```
@Composable
fun VideoPlayerView(
modifier: Modifier = Modifier,
exoPlayer: ExoPlayer,
defaultArtWork: Drawable? = null,
onFullScreenModeChanged: (isFullScreen: Boolean) -> Unit
) {
AndroidView(
modifier = modifier,
factory = { context ->
/// This factory function always create StyledPlayerView with "isFullScreen" to "false"
StyledPlayerView(context).apply {
setShowNextButton(false)
setShowPreviousButton(false)
setShowShuffleButton(false)
setShowSubtitleButton(false)
setShowShuffleButton(false)
setControllerOnFullScreenModeChangedListener { isFullScreen ->
onFullScreenModeChanged(isFullScreen)
}
defaultArtwork = defaultArtWork
player = exoPlayer
layoutParams = FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT,
)
}
},
)
}
```
Is it possible to initialize ```isFullScreen``` property to true when creating StyledPlayerView? or other suggestion?
Thank you for this awesome library.
Contributor guide
Assessment
This issue has not been assessed yet.