Skip to content

Commit dc94c71

Browse files
author
raymondzheng
committed
ijkplayer-ios: not setup opengl in background
1 parent a8bb0b3 commit dc94c71

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ios/IJKMediaPlayer/IJKMediaPlayer/ijkmedia/ijksdl/ios/IJKSDLGLView.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ - (id) initWithFrame:(CGRect)frame
8585
[self registerApplicationObservers];
8686

8787
_didSetupGL = NO;
88-
[self setupGLOnce];
88+
if ([self isApplicationActive] == YES)
89+
[self setupGLOnce];
8990
}
9091

9192
return self;
@@ -496,6 +497,7 @@ - (void)unregisterApplicationObservers
496497
- (void)applicationWillEnterForeground
497498
{
498499
NSLog(@"IJKSDLGLView:applicationWillEnterForeground: %d", (int)[UIApplication sharedApplication].applicationState);
500+
[self setupGLOnce];
499501
_applicationState = IJKSDLGLViewApplicationForegroundState;
500502
[self toggleGLPaused:NO];
501503
}
@@ -510,13 +512,15 @@ - (void)applicationWillResignActive
510512
{
511513
NSLog(@"IJKSDLGLView:applicationWillResignActive: %d", (int)[UIApplication sharedApplication].applicationState);
512514
[self toggleGLPaused:YES];
515+
glFinish();
513516
}
514517

515518
- (void)applicationDidEnterBackground
516519
{
517520
NSLog(@"IJKSDLGLView:applicationDidEnterBackground: %d", (int)[UIApplication sharedApplication].applicationState);
518521
_applicationState = IJKSDLGLViewApplicationBackgroundState;
519522
[self toggleGLPaused:YES];
523+
glFinish();
520524
}
521525

522526
- (void)applicationWillTerminate

0 commit comments

Comments
 (0)