-
Notifications
You must be signed in to change notification settings - Fork 481
Life Cycle
changsanjiang edited this page Oct 20, 2019
·
2 revisions
// Create player(strong reference)
self.player = [[SJVideoPlayer alloc] init];
// Destroy the player. if the player no strong reference, the player will automatically destroy
self.player = nil;
@implementation DemoViewController
// Pause playback when view did disappear
- (void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
[self.player pause];
self.player.vc_isDisappeared = YES;
}
// Resume playback when view did appear
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[self.player play];
self.player.vc_isDisappeared = NO;
}
@end