fix(ios): fix onBandwidth update event (old ios api is deprecated and doens't work) (#4140)
This commit is contained in:
@@ -284,11 +284,11 @@ class RCTPlayerObserver: NSObject, AVPlayerItemMetadataOutputPushDelegate, AVPla
|
||||
name: NSNotification.Name.AVPlayerItemFailedToPlayToEndTime,
|
||||
object: nil)
|
||||
|
||||
NotificationCenter.default.removeObserver(_handlers, name: NSNotification.Name.AVPlayerItemNewAccessLogEntry, object: player?.currentItem)
|
||||
NotificationCenter.default.removeObserver(_handlers, name: AVPlayerItem.newAccessLogEntryNotification, object: player?.currentItem)
|
||||
|
||||
NotificationCenter.default.addObserver(_handlers,
|
||||
selector: #selector(RCTPlayerObserverHandlerObjc.handleAVPlayerAccess(notification:)),
|
||||
name: NSNotification.Name.AVPlayerItemNewAccessLogEntry,
|
||||
name: AVPlayerItem.newAccessLogEntryNotification,
|
||||
object: player?.currentItem)
|
||||
}
|
||||
|
||||
|
@@ -1661,7 +1661,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
|
||||
}
|
||||
|
||||
guard let lastEvent = accessLog.events.last else { return }
|
||||
onVideoBandwidthUpdate?(["bitrate": lastEvent.observedBitrate, "target": reactTag])
|
||||
onVideoBandwidthUpdate?(["bitrate": lastEvent.indicatedBitrate, "target": reactTag])
|
||||
}
|
||||
|
||||
func handleTracksChange(playerItem _: AVPlayerItem, change _: NSKeyValueObservedChange<[AVPlayerItemTrack]>) {
|
||||
|
Reference in New Issue
Block a user