Skip to content

Commit

Permalink
[CORE-4969] Fixed issue for Fragments and jetpack compose detection
Browse files Browse the repository at this point in the history
  • Loading branch information
KharchenkoAlex committed Oct 8, 2024
1 parent be0cb56 commit 917ffd4
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ class BitmovinVideoPlayerPlugin : VideoPlayerPlugin {
@Composable
override fun PlayerView(hlsUrl: String): Unit {
val context = LocalContext.current
val isJetpackCompose = LocalViewModelStoreOwner.current != null
val isJetpackCompose = when (context) {
is ComponentActivity -> true
else -> false
}

val activity = context.findActivity() as? ComponentActivity
val playerViewModel: VideoPlayerViewModel = if (isJetpackCompose) viewModel() else activity?.let {
Expand Down

0 comments on commit 917ffd4

Please sign in to comment.