@stepincto/expo-video 1.0.6 → 1.0.7

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.
@@ -44,11 +44,7 @@ class VideoManager {
44
44
  videoViews.remove(videoView)
45
45
  }
46
46
 
47
- func onAppForegrounded() {
48
- for videoPlayer in videoPlayers.allObjects {
49
- videoPlayer.setTracksEnabled(true)
50
- }
51
- }
47
+ func onAppForegrounded() {}
52
48
 
53
49
  func onAppBackgrounded() {
54
50
  for videoView in videoViews.allObjects {
@@ -56,8 +52,9 @@ class VideoManager {
56
52
  continue
57
53
  }
58
54
  if player.staysActiveInBackground == true {
59
- player.setTracksEnabled(videoView.isInPictureInPicture)
60
- } else if !videoView.isInPictureInPicture {
55
+ player.ref.audiovisualBackgroundPlaybackPolicy = .continuesIfPossible
56
+ } else if !videoView.playerViewController.isInPictureInPicture {
57
+ player.ref.audiovisualBackgroundPlaybackPolicy = .pauses
61
58
  player.ref.pause()
62
59
  }
63
60
  }
@@ -272,23 +272,6 @@ internal final class VideoPlayer: SharedRef<AVPlayer>, Hashable, VideoPlayerObse
272
272
  return
273
273
  }
274
274
 
275
- /**
276
- * iOS automatically pauses videos when the app enters the background. Only way to avoid this is to detach the player from the playerLayer.
277
- * Typical way of doing this for `AVPlayerViewController` is setting `playerViewController.player = nil`, but that makes the
278
- * video invisible for around a second after foregrounding, disabling the tracks requires more code, but works a lot faster.
279
- */
280
- func setTracksEnabled(_ enabled: Bool) {
281
- ref.currentItem?.tracks.forEach({ track in
282
- guard let assetTrack = track.assetTrack else {
283
- return
284
- }
285
-
286
- if assetTrack.hasMediaCharacteristic(AVMediaCharacteristic.visual) {
287
- track.isEnabled = enabled
288
- }
289
- })
290
- }
291
-
292
275
  private func getBufferedPosition() -> Double {
293
276
  guard let currentItem = ref.currentItem else {
294
277
  return -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stepincto/expo-video",
3
3
  "title": "Expo Video",
4
- "version": "1.0.6",
4
+ "version": "1.0.7",
5
5
  "originalUpstreamVersion": "2.2.2",
6
6
  "description": "A cross-platform, performant video component for React Native and Expo with Web support",
7
7
  "main": "build/index.js",