react-native-theoplayer 9.1.0 → 9.1.1

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,12 +5,18 @@ 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
+ ## [9.1.1] - 25-04-24
9
+
10
+ ### Fixed
11
+
12
+ - Fixed an issue on Android where a muted player would still be paused by the `AudioFocusManager`.
13
+
8
14
  ## [9.1.0] - 25-04-23
9
15
 
10
16
  ### Added
11
17
 
12
18
  - Added iOS support for `sseEndpoint` property to `TheoAdDescription`.
13
- - Added iOS support for sideloaded chapter TextTracks.
19
+ - Added iOS support for side-loaded chapter TextTracks.
14
20
 
15
21
  ### Changed
16
22
 
@@ -20,7 +20,6 @@ import com.theoplayer.android.api.ads.dai.GoogleDaiIntegrationFactory
20
20
  import com.theoplayer.android.api.ads.ima.GoogleImaConfiguration
21
21
  import com.theoplayer.android.api.ads.ima.GoogleImaIntegration
22
22
  import com.theoplayer.android.api.ads.ima.GoogleImaIntegrationFactory
23
- import com.theoplayer.android.api.ads.theoads.TheoAdDescription
24
23
  import com.theoplayer.android.api.ads.theoads.TheoAdsIntegration
25
24
  import com.theoplayer.android.api.ads.theoads.TheoAdsIntegrationFactory
26
25
  import com.theoplayer.android.api.cast.CastIntegration
@@ -354,7 +353,7 @@ class ReactTHEOplayerContext private constructor(
354
353
  binder?.updateNotification(PlaybackStateCompat.STATE_PLAYING)
355
354
  applyAllowedMediaControls()
356
355
  audioBecomingNoisyManager.setEnabled(true)
357
- audioFocusManager?.retrieveAudioFocus()
356
+ audioFocusManager?.requestAudioFocus()
358
357
  }
359
358
 
360
359
  private val onPause = EventListener<PauseEvent> {
@@ -368,6 +367,14 @@ class ReactTHEOplayerContext private constructor(
368
367
  audioFocusManager?.abandonAudioFocus()
369
368
  }
370
369
 
370
+ private val onVolumeChange = EventListener<VolumeChangeEvent> {
371
+ if (player.isMuted) {
372
+ audioFocusManager?.abandonAudioFocus()
373
+ } else {
374
+ audioFocusManager?.requestAudioFocus()
375
+ }
376
+ }
377
+
371
378
  private fun addListeners() {
372
379
  player.apply {
373
380
  addEventListener(PlayerEventTypes.SOURCECHANGE, onSourceChange)
@@ -375,6 +382,7 @@ class ReactTHEOplayerContext private constructor(
375
382
  addEventListener(PlayerEventTypes.PAUSE, onPause)
376
383
  addEventListener(PlayerEventTypes.PLAY, onPlay)
377
384
  addEventListener(PlayerEventTypes.ENDED, onEnded)
385
+ addEventListener(PlayerEventTypes.VOLUMECHANGE, onVolumeChange)
378
386
  }
379
387
  }
380
388
 
@@ -385,6 +393,7 @@ class ReactTHEOplayerContext private constructor(
385
393
  removeEventListener(PlayerEventTypes.PAUSE, onPause)
386
394
  removeEventListener(PlayerEventTypes.PLAY, onPlay)
387
395
  removeEventListener(PlayerEventTypes.ENDED, onEnded)
396
+ removeEventListener(PlayerEventTypes.VOLUMECHANGE, onVolumeChange)
388
397
  }
389
398
  }
390
399
 
@@ -416,7 +425,7 @@ class ReactTHEOplayerContext private constructor(
416
425
  mediaSessionConnector?.setActive(BuildConfig.EXTENSION_MEDIASESSION)
417
426
  playerView.onResume()
418
427
  if (!player.isPaused) {
419
- audioFocusManager?.retrieveAudioFocus()
428
+ audioFocusManager?.requestAudioFocus()
420
429
  }
421
430
  }
422
431
 
@@ -120,6 +120,10 @@ class AudioFocusManager(
120
120
  if (player?.ads?.isPlaying == true) {
121
121
  return
122
122
  }
123
+ // Don't pause when the player is muted
124
+ if (player?.isMuted == true) {
125
+ return
126
+ }
123
127
  synchronized(focusLock) {
124
128
  // We should only resume if playback was interrupted
125
129
  resumeOnFocusGain = transient && !(player?.isPaused ?: true)
@@ -153,7 +157,11 @@ class AudioFocusManager(
153
157
  *
154
158
  * @return True if audio focus is granted, false otherwise.
155
159
  */
156
- fun retrieveAudioFocus(): Boolean {
160
+ fun requestAudioFocus(): Boolean {
161
+ if (player?.isMuted == true) {
162
+ // There is no point requesting audio focus when the player is muted.
163
+ return true
164
+ }
157
165
  val result = audioManager?.let {
158
166
  AudioManagerCompat.requestAudioFocus(it, audioFocusRequest)
159
167
  }
@@ -1 +1 @@
1
- {"version":"9.1.0","buildDate":"2025-04-23T13:44:23.733Z"}
1
+ {"version":"9.1.1","buildDate":"2025-04-24T14:49:50.905Z"}
@@ -1 +1 @@
1
- {"version":"9.1.0","buildDate":"2025-04-23T13:44:23.733Z"}
1
+ {"version":"9.1.1","buildDate":"2025-04-24T14:49:50.905Z"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-theoplayer",
3
- "version": "9.1.0",
3
+ "version": "9.1.1",
4
4
  "description": "A THEOplayer video component for react-native.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
package/src/manifest.json CHANGED
@@ -1 +1 @@
1
- {"version":"9.1.0","buildDate":"2025-04-23T13:44:23.733Z"}
1
+ {"version":"9.1.1","buildDate":"2025-04-24T14:49:50.905Z"}