Search code examples
iphoneobjective-ciosios4media-player

Iphone mpmediaplayer, server connection died


Is there anyway to catch this notification?

_serverConnectionDiedNotification. Info -- notification=NSConcreteNotification 0x2e7f70 {name = AVController_ServerConnectionDiedNotification; object = <AVController: 0x2aa2a0>}, AVController = <AVController: 0x2aa2a0>, currentTime = 0.00

It occurs when my mediaplayer loses its connection to the server. I would like to catch this notification and try to reconnect to the server again, to continue playing the video.


Solution

  • You may register for that notification using this method from the NSNotificationCenter

    - (void)addObserver:(id)notificationObserver selector:(SEL)notificationSelector name:(NSString *)notificationName object:(id)notificationSender
    

    However NSConcreteNotification is a private subclass of the abstract NSNotification class and since Apple doesn't like anyone using private classes I am not sure if that would work.