Quantcast
Channel: MPMoviePlayer play on when application goes Background - Stack Overflow
Viewing all articles
Browse latest Browse all 4

MPMoviePlayer play on when application goes Background

$
0
0

I am working with iOS5.

I am working on HTTPLivestream project .Here i am using MPMovieplayer ,my problem is when application goes to background there is no audio . i am changing the plist in background mode is audio.But there is no result please help me .

AppDel

- (void)applicationDidEnterBackground:(UIApplication *)application {  [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];  [[AVAudioSession sharedInstance] setActive: YES error: nil];  UIApplication *app = [UIApplication sharedApplication];  backgroundTask = [app beginBackgroundTaskWithExpirationHandler:^{  }];  dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{  });}

RadioControlView

  NSString *path =[[NSString alloc] initWithString:@"http://*******/alayam/alayam/playlist.m3u8"];  audioUrl=[NSURL URLWithString:path];  appDelegate.player =  [[MPMoviePlayerController alloc] initWithContentURL:audioUrl];                                   [[NSNotificationCenter defaultCenter] addObserver:self                                                          selector:@selector(loadStateDidChange:)                                                              name:MPMoviePlayerLoadStateDidChangeNotification                                                            object:appDelegate.player];                if ([appDelegate.player respondsToSelector:@selector(loadState)])                 {                    [appDelegate.player setControlStyle:MPMovieControlModeVolumeOnly];                    [appDelegate.player setFullscreen:YES];                    [appDelegate.player prepareToPlay];                 }- (void)loadStateDidChange:(NSNotification *)notification      {           [[NSNotificationCenter defaultCenter]removeObserver:self name:MPMoviePlayerLoadStateDidChangeNotification object:appDelegate.player];      }

Thanks in Advance


Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>