IOS bandwidth reporting
IOS bandwidth reporting
This commit is contained in:
parent
a1a0ca648c
commit
b256f2d4d8
@ -14,6 +14,7 @@
|
||||
@property (nonatomic, copy) RCTBubblingEventBlock onVideoBuffer;
|
||||
@property (nonatomic, copy) RCTBubblingEventBlock onVideoError;
|
||||
@property (nonatomic, copy) RCTBubblingEventBlock onVideoProgress;
|
||||
@property (nonatomic, copy) RCTBubblingEventBlock onBandwidthUpdate;
|
||||
@property (nonatomic, copy) RCTBubblingEventBlock onVideoSeek;
|
||||
@property (nonatomic, copy) RCTBubblingEventBlock onVideoEnd;
|
||||
@property (nonatomic, copy) RCTBubblingEventBlock onTimedMetadata;
|
||||
|
@ -592,8 +592,10 @@ static int const RCTVideoUnset = -1;
|
||||
- (void)handleAVPlayerAccess:(NSNotification *)notification {
|
||||
AVPlayerItemAccessLog *accessLog = [((AVPlayerItem *)notification.object) accessLog];
|
||||
AVPlayerItemAccessLogEvent *lastEvent = accessLog.events.lastObject;
|
||||
float lastEventNumber = lastEvent.indicatedBitrate;
|
||||
RCTLog(@"Switch indicatedBitrate from: %f to: %f", lastEvent.observedBitrate, lastEvent.indicatedBitrate);
|
||||
|
||||
if (self.onBandwidthUpdate) {
|
||||
self.onBandwidthUpdate(@{@"bitrateEstimate": [NSNumber numberWithFloat:(lastEvent.observedBitrate/1000)]});
|
||||
}
|
||||
}
|
||||
|
||||
- (void)playbackStalled:(NSNotification *)notification
|
||||
|
@ -44,6 +44,7 @@ RCT_EXPORT_VIEW_PROPERTY(onVideoLoad, RCTBubblingEventBlock);
|
||||
RCT_EXPORT_VIEW_PROPERTY(onVideoBuffer, RCTBubblingEventBlock);
|
||||
RCT_EXPORT_VIEW_PROPERTY(onVideoError, RCTBubblingEventBlock);
|
||||
RCT_EXPORT_VIEW_PROPERTY(onVideoProgress, RCTBubblingEventBlock);
|
||||
RCT_EXPORT_VIEW_PROPERTY(onBandwidthUpdate, RCTBubblingEventBlock);
|
||||
RCT_EXPORT_VIEW_PROPERTY(onVideoSeek, RCTBubblingEventBlock);
|
||||
RCT_EXPORT_VIEW_PROPERTY(onVideoEnd, RCTBubblingEventBlock);
|
||||
RCT_EXPORT_VIEW_PROPERTY(onTimedMetadata, RCTBubblingEventBlock);
|
||||
|
Loading…
Reference in New Issue
Block a user