Last active
August 29, 2015 13:55
-
-
Save saiday/8789319 to your computer and use it in GitHub Desktop.
setupHysteriaPlayer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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