提交 d94920d1 编写于 作者: B bbcallen

ios: observe applicationDidEnterBackgroundNotification for pausing

上级 d9175ac1
......@@ -101,6 +101,11 @@
ijkmp_ios_set_glview(_mediaPlayer, glView);
ijkmp_set_overlay_format(_mediaPlayer, chroma);
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(applicationDidEnterBackgroundNotification)
name:UIApplicationDidEnterBackgroundNotification
object:nil];
[options applyTo:_mediaPlayer];
_keepScreenOnWhilePlaying = YES;
......@@ -110,6 +115,13 @@
return self;
}
- (void)applicationDidEnterBackgroundNotification
{
dispatch_async(dispatch_get_main_queue(), ^{
[self pause];
});
}
- (void)setScreenOn: (BOOL)on
{
[UIApplication sharedApplication].idleTimerDisabled = on;
......@@ -118,6 +130,10 @@
- (void)dealloc
{
[_ffMrl removeTempFiles];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:UIApplicationDidEnterBackgroundNotification
object:nil];
}
- (void)prepareToPlay
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册