this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

tweak background handling on android

Hailey d5b61819 6d78c04d

+5 -7
+5 -7
android/src/main/java/expo/modules/blueskyvideo/BlueskyVideoModule.kt
··· 3 3 import android.net.Uri 4 4 import android.os.Handler 5 5 import android.os.Looper 6 + import androidx.media3.common.Player 6 7 import androidx.media3.common.util.UnstableApi 7 8 import expo.modules.kotlin.modules.Module 8 9 import expo.modules.kotlin.modules.ModuleDefinition 9 10 10 11 @UnstableApi 11 12 class BlueskyVideoModule : Module() { 12 - private var wasPlaying = false 13 + private var wasPlayingPlayer: Player? = null 13 14 14 15 override fun definition() = ModuleDefinition { 15 16 Name("BlueskyVideo") ··· 19 20 val player = view.player ?: return@OnActivityEntersForeground 20 21 21 22 if (player.isPlaying) { 22 - wasPlaying = true 23 + wasPlayingPlayer = player 23 24 player.pause() 24 25 } 25 26 } 26 27 27 28 OnActivityEntersBackground { 28 - if (!wasPlaying) { 29 - return@OnActivityEntersBackground 30 - } 31 - val view = ViewManager.getActiveView() ?: return@OnActivityEntersBackground 32 - val player = view.player ?: return@OnActivityEntersBackground 29 + val player = wasPlayingPlayer ?: return@OnActivityEntersBackground 33 30 player.play() 31 + wasPlayingPlayer = null 34 32 } 35 33 36 34 AsyncFunction("updateActiveVideoViewAsync") {