react-native-theoplayer 3.9.1 → 3.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,11 +5,17 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.1.0/)
6
6
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.9.2] - 24-03-06
9
+
10
+ ### Changed
11
+
12
+ - Never pause play-out when losing audio focus while playing an advertisement.
13
+
8
14
  ## [3.9.1] - 24-03-05
9
15
 
10
16
  ### Changed
11
17
 
12
- - Bumped google-cast-sdk dependency to v4.8.0 for iOS.
18
+ - Bumped google-cast-sdk dependency to v4.8.0 for iOS.
13
19
 
14
20
  ## [3.9.0] - 24-03-04
15
21
 
@@ -93,20 +93,12 @@ class AudioFocusManager(
93
93
 
94
94
  // Used to indicate a loss of audio focus of unknown duration.
95
95
  AudioManager.AUDIOFOCUS_LOSS -> {
96
- synchronized(focusLock) {
97
- // This is not a transient (short) loss, we shouldn't automatically resume for now.
98
- resumeOnFocusGain = false
99
- }
100
- player?.pause()
96
+ onAudioFocusLoss(false)
101
97
  }
102
98
 
103
99
  // Used to indicate a transient (short) loss of audio focus.
104
100
  AudioManager.AUDIOFOCUS_LOSS_TRANSIENT -> {
105
- synchronized(focusLock) {
106
- // We should only resume if playback was interrupted
107
- resumeOnFocusGain = !(player?.isPaused ?: true)
108
- }
109
- player?.pause()
101
+ onAudioFocusLoss(true)
110
102
  }
111
103
 
112
104
  // Used to indicate a transient (short) loss of audio focus where the loser of the audio focus
@@ -123,6 +115,18 @@ class AudioFocusManager(
123
115
  }
124
116
  }
125
117
 
118
+ private fun onAudioFocusLoss(transient: Boolean) {
119
+ // Don't pause when playing an ad
120
+ if (player?.ads?.isPlaying == true) {
121
+ return
122
+ }
123
+ synchronized(focusLock) {
124
+ // We should only resume if playback was interrupted
125
+ resumeOnFocusGain = transient && !(player?.isPaused ?: true)
126
+ }
127
+ player?.pause()
128
+ }
129
+
126
130
  private fun fromAudioFocusChange(focusChange: Int?): String {
127
131
  return when (focusChange) {
128
132
  AudioManager.AUDIOFOCUS_GAIN -> "AUDIOFOCUS_GAIN"
@@ -9,15 +9,11 @@ import android.content.IntentFilter
9
9
  import android.content.pm.PackageManager
10
10
  import android.os.Build
11
11
  import android.view.View
12
- import android.view.View.OnLayoutChangeListener
13
12
  import android.view.ViewGroup
14
- import android.view.ViewGroup.LayoutParams.MATCH_PARENT
15
13
  import android.view.ViewParent
16
14
  import androidx.activity.ComponentActivity
17
15
  import androidx.core.view.WindowInsetsCompat
18
16
  import androidx.core.view.WindowInsetsControllerCompat
19
- import androidx.core.view.children
20
- import androidx.core.view.updateLayoutParams
21
17
  import androidx.lifecycle.Lifecycle
22
18
  import com.facebook.react.ReactRootView
23
19
  import com.facebook.react.uimanager.ThemedReactContext
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-theoplayer",
3
- "version": "3.9.1",
3
+ "version": "3.9.2",
4
4
  "description": "A THEOplayer video component for react-native.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",