Test fix for iOS Bluetooth glitch
This commit is contained in:
parent
23fa345b30
commit
fc1a6b37e9
|
@ -813,40 +813,40 @@
|
||||||
_bufferUnconfirmed = YES;
|
_bufferUnconfirmed = YES;
|
||||||
// If we've skipped or transitioned to a new item and we're not
|
// If we've skipped or transitioned to a new item and we're not
|
||||||
// currently in the middle of a seek
|
// currently in the middle of a seek
|
||||||
if (CMTIME_IS_INVALID(_seekPos) && _player.currentItem.status == AVPlayerItemStatusReadyToPlay) {
|
/* if (CMTIME_IS_INVALID(_seekPos) && _player.currentItem.status == AVPlayerItemStatusReadyToPlay) { */
|
||||||
[self updatePosition];
|
/* [self updatePosition]; */
|
||||||
IndexedAudioSource *source = ((IndexedPlayerItem *)_player.currentItem).audioSource;
|
/* IndexedAudioSource *source = ((IndexedPlayerItem *)_player.currentItem).audioSource; */
|
||||||
// We should already be at position zero but for
|
/* // We should already be at position zero but for */
|
||||||
// ClippingAudioSource it might be off by some milliseconds so we
|
/* // ClippingAudioSource it might be off by some milliseconds so we */
|
||||||
// consider anything <= 100 as close enough.
|
/* // consider anything <= 100 as close enough. */
|
||||||
if ((int)(1000 * CMTimeGetSeconds(source.position)) > 100) {
|
/* if ((int)(1000 * CMTimeGetSeconds(source.position)) > 100) { */
|
||||||
NSLog(@"On currentItem change, seeking back to zero");
|
/* NSLog(@"On currentItem change, seeking back to zero"); */
|
||||||
BOOL shouldResumePlayback = NO;
|
/* BOOL shouldResumePlayback = NO; */
|
||||||
AVPlayerActionAtItemEnd originalEndAction = _player.actionAtItemEnd;
|
/* AVPlayerActionAtItemEnd originalEndAction = _player.actionAtItemEnd; */
|
||||||
if (_playing && CMTimeGetSeconds(CMTimeSubtract(source.position, source.duration)) >= 0) {
|
/* if (_playing && CMTimeGetSeconds(CMTimeSubtract(source.position, source.duration)) >= 0) { */
|
||||||
NSLog(@"Need to pause while rewinding because we're at the end");
|
/* NSLog(@"Need to pause while rewinding because we're at the end"); */
|
||||||
shouldResumePlayback = YES;
|
/* shouldResumePlayback = YES; */
|
||||||
_player.actionAtItemEnd = AVPlayerActionAtItemEndPause;
|
/* _player.actionAtItemEnd = AVPlayerActionAtItemEndPause; */
|
||||||
[_player pause];
|
/* [_player pause]; */
|
||||||
}
|
/* } */
|
||||||
[self enterBuffering:@"currentItem changed, seeking"];
|
/* [self enterBuffering:@"currentItem changed, seeking"]; */
|
||||||
[self updatePosition];
|
/* [self updatePosition]; */
|
||||||
[self broadcastPlaybackEvent];
|
/* [self broadcastPlaybackEvent]; */
|
||||||
__weak __typeof__(self) weakSelf = self;
|
/* __weak __typeof__(self) weakSelf = self; */
|
||||||
[source seek:kCMTimeZero completionHandler:^(BOOL finished) {
|
/* [source seek:kCMTimeZero completionHandler:^(BOOL finished) { */
|
||||||
[weakSelf leaveBuffering:@"currentItem changed, finished seek"];
|
/* [weakSelf leaveBuffering:@"currentItem changed, finished seek"]; */
|
||||||
[weakSelf updatePosition];
|
/* [weakSelf updatePosition]; */
|
||||||
[weakSelf broadcastPlaybackEvent];
|
/* [weakSelf broadcastPlaybackEvent]; */
|
||||||
if (shouldResumePlayback) {
|
/* if (shouldResumePlayback) { */
|
||||||
weakSelf.player.actionAtItemEnd = originalEndAction;
|
/* weakSelf.player.actionAtItemEnd = originalEndAction; */
|
||||||
// TODO: This logic is almost duplicated in seek. See if we can reuse this code.
|
/* // TODO: This logic is almost duplicated in seek. See if we can reuse this code. */
|
||||||
weakSelf.player.rate = weakSelf.speed;
|
/* weakSelf.player.rate = weakSelf.speed; */
|
||||||
}
|
/* } */
|
||||||
}];
|
/* }]; */
|
||||||
} else {
|
/* } else { */
|
||||||
// Already at zero, no need to seek.
|
/* // Already at zero, no need to seek. */
|
||||||
}
|
/* } */
|
||||||
}
|
/* } */
|
||||||
} else if ([keyPath isEqualToString:@"loadedTimeRanges"]) {
|
} else if ([keyPath isEqualToString:@"loadedTimeRanges"]) {
|
||||||
IndexedPlayerItem *playerItem = (IndexedPlayerItem *)object;
|
IndexedPlayerItem *playerItem = (IndexedPlayerItem *)object;
|
||||||
if (playerItem != _player.currentItem) return;
|
if (playerItem != _player.currentItem) return;
|
||||||
|
|
Loading…
Reference in New Issue