crash fix for pip in android 12

This commit is contained in:
LagradOst 2021-10-21 23:20:13 +02:00
parent 8ca808ce37
commit d5ae225070

View file

@ -871,13 +871,22 @@ class PlayerFragment : Fragment() {
} }
private fun getPen(code: Int): PendingIntent { private fun getPen(code: Int): PendingIntent {
return PendingIntent.getBroadcast( return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
PendingIntent.getBroadcast(
activity,
code,
Intent("media_control").putExtra("control_type", code),
PendingIntent.FLAG_IMMUTABLE
)
} else {
PendingIntent.getBroadcast(
activity, activity,
code, code,
Intent("media_control").putExtra("control_type", code), Intent("media_control").putExtra("control_type", code),
0 0
) )
} }
}
@SuppressLint("NewApi") @SuppressLint("NewApi")
private fun getRemoteAction(id: Int, title: String, event: PlayerEventType): RemoteAction { private fun getRemoteAction(id: Int, title: String, event: PlayerEventType): RemoteAction {