【问题标题】:iOS MPMoviePlayer (resume playback after app become Active)iOS MPMoviePlayer(应用激活后恢复播放)
【发布时间】:2013-03-27 23:21:28
【问题描述】:

我有应用,播放网络视频

一切正常

但当用户离开应用阅读电子邮件或其他任何东西时

然后玩家走了回来!!大问题

所以,我希望用户在返回应用后继续观看

这是我目前的代码

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didEnterBackground) name:UIApplicationDidEnterBackgroundNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didEnterforground) name:UIApplicationWillEnterForegroundNotification object:nil];

方法

- (void) didEnterBackground
{
[theMovie.moviePlayer pause];
NSLog(@"Playing pause");
}

- (void) didEnterforground
{
[theMovie.moviePlayer play];
NSLog(@"Playing resume");
}

知道我使用 [self presentMoviePlayerViewControllerAnimated:theMovie];不在视野中播放

如果代码有效,但没有任何效果

请帮忙

提前致谢

【问题讨论】:

    标签: playback mpmovieplayer resume


    【解决方案1】:

    答案很简单,编辑info.plist。
    添加后台权限、所需后台模式、设置类别应用播放音频

    试试吧!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-05-03
      • 1970-01-01
      • 2014-11-29
      • 1970-01-01
      • 2011-10-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多