私はウェブからビデオを再生するアプリを持っています
すべてが正常に動作します
しかし、ユーザーがメールなどを読むためにアプリを離れたとき
戻ってきてプレーヤーがいなくなった!! 大問題
だから、私はユーザーがアプリに戻った後に視聴を再開したい
ここに私のコードがあります
[[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]; を使用しています。ビューで再生しない
それはコードが機能するはずですが、何も機能しません
助けてください
前もって感謝します