Skip to content

Commit

Permalink
Fix iOS 10, MacOS 10.12 slow playback start time
Browse files Browse the repository at this point in the history
  • Loading branch information
saiday committed Dec 22, 2016
1 parent 9ba36a3 commit 0d67c97
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion HysteriaPlayer/HysteriaPlayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ - (void)playEmptySound
self.audioPlayer = [AVQueuePlayer queuePlayerWithItems:[NSArray arrayWithObject:playerItem]];
}
}

if ([self.audioPlayer respondsToSelector:@selector(automaticallyWaitsToMinimizeStalling)]) {
self.audioPlayer.automaticallyWaitsToMinimizeStalling = NO;
}
}

- (void)backgroundPlayable
Expand Down Expand Up @@ -914,11 +918,16 @@ - (NSInteger)randomIndex

- (void)deprecatePlayer
{
NSError *error;
tookAudioFocus = NO;
#if TARGET_OS_IPHONE
NSError *error;
[[AVAudioSession sharedInstance] setActive:NO error:&error];
[[UIApplication sharedApplication] endReceivingRemoteControlEvents];
if (error) {
if (!self.disableLogs) {
NSLog(@"HysteriaPlayer: set category error:%@", [error localizedDescription]);
}
}
#endif
[[NSNotificationCenter defaultCenter] removeObserver:self];

Expand Down

3 comments on commit 0d67c97

@patrickjquinn
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still seeing this on iOS 10.3, like 3-4 seconds before a remote stream's playback begins despite playback being reported via the delegate. Is there a way to set 'seconds until play starts' property similar to how StreamingKit does it?

@saiday
Copy link
Member Author

@saiday saiday commented on 0d67c97 Mar 30, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @patrickjquinn
Which HysteriaPlayer version or commit you using?
This commit fix deferred playback well.

Yes, seconds until play starts can be added to HysteriaPlayer as an option, but wondering is this a needed feature? doesn't we like playback start as soon as possible?

@patrickjquinn
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest Pods version (2.2.0 I believe?)

Well the only use case would be if you needed to ensure a large buffer when the user has limited network connectivity (i.e on 3G) but otherwise you're right, it doesn't need to be there.

When using StreamingKit I set it to 0.3 seconds in order to play upon the first packet being received, but i'd imagine there is a lot more complexity to doing zero latency streaming when building on AVAudioPlayer versus CoreAudio

Please sign in to comment.