iphone - Responding to MPMoviePlayerController notifications during background media playback -



iphone - Responding to MPMoviePlayerController notifications during background media playback -

i have app streams video net , plays using mpmovieplayercontroller object playback on device or via airplay.

the app supports background operation , has 'audio' alternative listed within required uibackgroundmodes key in plist file.

when playing on airplay, app can pushed background , video continues play properly. far, good.

according apple documentation:

including sound key tells scheme frameworks should go on playing , create necessary callbacks app @ appropriate intervals. if app not include key, sound beingness played app stops when app moves background.

however, these callbacks not beingness made.

the app uses 2 types of callback: associated notifications mpmovieplayercontroller , avplayer send during playback timer based callbacks monitor playback position , performance stats monitoring purposes.

looking @ apple's notes, expect receive first type of callback app can respond mpmovieplayerplaybackstatedidchangenotification, mpmovieplayerplaybackdidfinishnotification , mpmovieplayerloadstatedidchangenotification, doesn't happen.

does know if possible receive these during background airplay playback and, if so, how achieved?

**please note: app works correctly when running in foreground , receives notifications fine. when pushed background , playing on airplay notifications not received.

likewise, video plays on airplay in background properly. notifications not received**

i had issue , have fixed though few months back. send entire class film playback if doesn't work. note using navigation controller model.

note: tested on ipad 2 not on iphone.

i show vc this:

- (ibaction)playmovie:(id)sender { movievc* movcontroller = [[movievc alloc] initwithid:2]; movcontroller.view.backgroundcolor = [uicolor blackcolor]; appdelegate *appdel = [[uiapplication sharedapplication] delegate]; [appdel.navigationcontroller pushviewcontroller:movcontroller animated:no]; [movcontroller release]; }

then in movievc view controller class set video playback this:

- (void)initmovieplayer { mmovieplayer = [[mpmovieplayercontroller alloc] initwithcontenturl:[self getmovieurl]]; mmovieplayer.allowsairplay = yes; mmovieplayer.view.frame = [self.view bounds]; mmovieplayer.view.backgroundcolor = [uicolor clearcolor]; mmovieplayer.shouldautoplay = yes; mmovieplayer.fullscreen = yes; mmovieplayer.scalingmode = mpmoviescalingmodeaspectfit; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(moviepreloaddidfinish:) name:mpmovieplayerloadstatedidchangenotification object:mmovieplayer]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(movieplaybackdidfinish:) name:mpmovieplayerplaybackdidfinishnotification object:nil]; }

this fixed me, if doesn't prepare comment , sick edit entire class file.

iphone ios mpmovieplayercontroller multitasking avplayer

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -