expo-video 2.0.2 → 2.0.3

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
@@ -10,6 +10,13 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 2.0.3 — 2024-12-19
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - [iOS] Fix empty notification showing on iOS when `showNowPlayingNotification` is set to false. ([#33698](https://github.com/expo/expo/pull/33698) by [@behenate](https://github.com/behenate))
18
+ - [iOS] Dispatch current player item changes on main queue to fix KVO-related crashes. ([#33123](https://github.com/expo/expo/pull/33123) by [@behenate](https://github.com/behenate))
19
+
13
20
  ## 2.0.2 — 2024-11-29
14
21
 
15
22
  _This version does not introduce any user-facing changes._
@@ -1,7 +1,7 @@
1
1
  apply plugin: 'com.android.library'
2
2
 
3
3
  group = 'host.exp.exponent'
4
- version = '2.0.2'
4
+ version = '2.0.3'
5
5
 
6
6
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
7
7
  apply from: expoModulesCorePlugin
@@ -14,7 +14,7 @@ android {
14
14
  namespace "expo.modules.video"
15
15
  defaultConfig {
16
16
  versionCode 1
17
- versionName '2.0.2'
17
+ versionName '2.0.3'
18
18
  }
19
19
  }
20
20
 
@@ -84,6 +84,10 @@ class NowPlayingManager: VideoPlayerObserverDelegate {
84
84
 
85
85
  removeExistingTargets(commandCenter: commandCenter)
86
86
 
87
+ guard self.mostRecentInteractionPlayer != nil else {
88
+ return
89
+ }
90
+
87
91
  playTarget = commandCenter.playCommand.addTarget { [weak self] _ in
88
92
  guard let self, let player = self.mostRecentInteractionPlayer else {
89
93
  return .commandFailed
@@ -135,12 +135,7 @@ internal final class VideoPlayer: SharedRef<AVPlayer>, Hashable, VideoPlayerObse
135
135
  NowPlayingManager.shared.unregisterPlayer(self)
136
136
  VideoManager.shared.unregister(videoPlayer: self)
137
137
 
138
- // The current item has to be replaced with nil from the main thread. When replacing from the SharedObjectRegistry queue
139
- // sometimes the KVOs used by AVPlayerViewController would try to deliver updates about the item being changed to nil after the
140
- // player was deallocated, which caused crashes.
141
- DispatchQueue.main.async { [pointer] in
142
- pointer.replaceCurrentItem(with: nil)
143
- }
138
+ try? self.replaceCurrentItem(with: nil)
144
139
  }
145
140
 
146
141
  func replaceCurrentItem(with videoSource: VideoSource?) throws {
@@ -148,7 +143,9 @@ internal final class VideoPlayer: SharedRef<AVPlayer>, Hashable, VideoPlayerObse
148
143
  let videoSource = videoSource,
149
144
  let url = videoSource.uri
150
145
  else {
151
- pointer.replaceCurrentItem(with: nil)
146
+ DispatchQueue.main.async { [weak self] in
147
+ self?.pointer.replaceCurrentItem(with: nil)
148
+ }
152
149
  return
153
150
  }
154
151
 
@@ -166,7 +163,13 @@ internal final class VideoPlayer: SharedRef<AVPlayer>, Hashable, VideoPlayerObse
166
163
 
167
164
  playerItem.audioTimePitchAlgorithm = preservesPitch ? .spectral : .varispeed
168
165
  playerItem.preferredForwardBufferDuration = bufferOptions.preferredForwardBufferDuration
169
- pointer.replaceCurrentItem(with: playerItem)
166
+
167
+ // The current item has to be replaced from the main thread. When replacing from other queues
168
+ // sometimes the KVOs will try to deliver updates after the item has been changed or player deallocated,
169
+ // which causes crashes.
170
+ DispatchQueue.main.async { [weak self] in
171
+ self?.pointer.replaceCurrentItem(with: playerItem)
172
+ }
170
173
  }
171
174
 
172
175
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "expo-video",
3
3
  "title": "Expo Video",
4
- "version": "2.0.2",
4
+ "version": "2.0.3",
5
5
  "description": "A cross-platform, performant video component for React Native and Expo with Web support",
6
6
  "main": "build/index.js",
7
7
  "types": "build/index.d.ts",
@@ -38,5 +38,5 @@
38
38
  "react": "*",
39
39
  "react-native": "*"
40
40
  },
41
- "gitHead": "728158f99d680cf64fb06f08301d3806c18c6f63"
41
+ "gitHead": "a246df22c427d8c6c905de0915ed50f721fdf062"
42
42
  }