StreetVoice / HysteriaPlayer

Objective-C audio player, sitting on top of AVPlayer
Other
583 stars 99 forks source link

Fatal Exception: NSInvalidArgumentException #98

Open newbdez33 opened 8 years ago

newbdez33 commented 8 years ago

my users crash many times on this:

Fatal Exception: NSInvalidArgumentException AVPlayerItem cannot service a seek request with a completion handler until its status is AVPlayerItemStatusReadyToPlay.

HysteriaPlayer.m line 293 -[HysteriaPlayer findSourceInPlayerItems:]

any suggestion? Thank you very much!

saiday commented 8 years ago

The error log says it, do you have seeking functionality in your app? If so, disable it until your AVPlayerItem's status update to AVPlayerItemStatusReadyToPlay.

HysteriaPlayer had a delegate about AVPlayerItem status for you.

On Tuesday, December 1, 2015, Jack notifications@github.com wrote:

my users crash many times on this:

Fatal Exception: NSInvalidArgumentException AVPlayerItem cannot service a seek request with a completion handler until its status is AVPlayerItemStatusReadyToPlay.

HysteriaPlayer.m line 293 -[HysteriaPlayer findSourceInPlayerItems:]

any suggestion? Thank you very much!

— Reply to this email directly or view it on GitHub https://github.com/StreetVoice/HysteriaPlayer/issues/98.

newbdez33 commented 8 years ago

Hi Saiday, thanks for the reply. But I don't have seeking function.

the seek call is from "findSourceInPlayerItems as you can see:

In HysteraPlayer.m

- (BOOL)findSourceInPlayerItems:(NSUInteger)index
{
    for (AVPlayerItem *item in self.playerItems) {
        NSInteger checkIndex = [[self getHysteriaIndex:item] integerValue];
        if (checkIndex == index) {
            [item seekToTime:kCMTimeZero completionHandler:^(BOOL finished) {
                [self insertPlayerItem:item];
            }];
            return YES;
        }
    }
    return NO;
}
saiday commented 8 years ago

Sorry, my fault. I see now.

Which version of HysteriaPlayer you using? If possible, can you attach stack log so I can trace on it.

On Tuesday, December 1, 2015, Jack notifications@github.com wrote:

Hi Saiday, thanks for the reply. But I don't have seeking function.

the seek call is from "findSourceInPlayerItems as you can see:

In HysteraPlayer.m

  • (BOOL)findSourceInPlayerItems:(NSUInteger)index { for (AVPlayerItem *item in self.playerItems) { NSInteger checkIndex = [[self getHysteriaIndex:item] integerValue]; if (checkIndex == index) { [item seekToTime:kCMTimeZero completionHandler:^(BOOL finished) { [self insertPlayerItem:item]; }]; return YES; } } return NO; }

— Reply to this email directly or view it on GitHub https://github.com/StreetVoice/HysteriaPlayer/issues/98#issuecomment-160832935 .

newbdez33 commented 8 years ago

I'm using pod version pod 'HysteriaPlayer', '= 2.1.0'

You my check the crash here: http://crashes.to/s/dce5979ad7c

Thanks!

saiday commented 8 years ago

Thank you, Jack

On Tuesday, December 1, 2015, Jack notifications@github.com wrote:

I'm using pod version pod 'HysteriaPlayer', '= 2.1.0'

You my check the crash here: http://crashes.to/s/dce5979ad7c

Thanks!

— Reply to this email directly or view it on GitHub https://github.com/StreetVoice/HysteriaPlayer/issues/98#issuecomment-160835712 .

saiday commented 8 years ago

@newbdez33 I've tested on findSourceInPlayerItems and it works well, my testing method is jump between next and previous track.

Are you jump to your current track?

A optional workaround can fix your problem, set memory cache to false. See

- (void)enableMemoryCached:(BOOL)memoryCache
newbdez33 commented 8 years ago

Yes it's all good when I test it. and I'm not sure how to re-produce this issue anyway. but I will try the workaround. Thank you!