Skip to content

Commit

Permalink
fix: Crash when playing a video #54
Browse files Browse the repository at this point in the history
  • Loading branch information
rhenwinch committed Feb 19, 2024
1 parent 5212461 commit d7c2bc8
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.os.Build
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.getValue
Expand All @@ -28,9 +29,17 @@ internal fun PlayerPipReceiver(
}
}

context.registerReceiver(
broadcastReceiver, IntentFilter(action)
)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
context.registerReceiver(
/* receiver = */ broadcastReceiver,
/* filter = */ IntentFilter(action),
/* flags = */ Context.RECEIVER_NOT_EXPORTED
)
} else {
context.registerReceiver(
broadcastReceiver, IntentFilter(action)
)
}

onDispose {
context.unregisterReceiver(broadcastReceiver)
Expand Down

0 comments on commit d7c2bc8

Please sign in to comment.