Skip to content

Instantly share code, notes, and snippets.

@saiday
Last active August 29, 2015 13:55
Show Gist options
  • Save saiday/8789319 to your computer and use it in GitHub Desktop.
Save saiday/8789319 to your computer and use it in GitHub Desktop.
setupHysteriaPlayer
- (void)setupHyseteriaPlayer
{
HysteriaPlayer *hysteriaPlayer = [HysteriaPlayer sharedInstance];
[hysteriaPlayer registerHandlerPlayerRateChanged:^{
} CurrentItemChanged:^(AVPlayerItem *item) {
} PlayerDidReachEnd:^{
}];
[hysteriaPlayer registerHandlerCurrentItemPreLoaded:^(CMTime time) {
NSLog(@"%f", CMTimeGetSeconds(time));
}];
[hysteriaPlayer registerHandlerReadyToPlay:^(HysteriaPlayerReadyToPlay identifier) {
switch (identifier) {
case HysteriaPlayerReadyToPlayCurrentItem:
if ([hysteriaPlayer getHysteriaPlayerStatus] != HysteriaPlayerStatusForcePause) {
[hysteriaPlayer play];
}
break;
case HysteriaPlayerReadyToPlayPlayer:
[hysteriaPlayer play];
break;
default:
break;
}
}];
[hysteriaPlayer registerHandlerFailed:^(HysteriaPlayerFailed identifier, NSError *error) {
switch (identifier) {
case HysteriaPlayerFailedCurrentItem:
break;
default:
break;
}
}];
[hysteriaPlayer setPlayerRepeatMode:RepeatMode_off];
[hysteriaPlayer enableMemoryCached:NO];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment