2

I have a MPMoviePlayerController that streams video. The problem is that the video and audio work fine in the simulator, but on the device, the view just turns black and no audio or video comes out. Here is my code:

- (IBAction)playVideoPress:(id)sender
{
    MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:mediaURL];

    _mpPlayer3 = player;

    [[NSNotificationCenter defaultCenter]
         addObserver:self
         selector:@selector(moviePlayerDidFinish:)
         name:MPMoviePlayerPlaybackDidFinishNotification
         object:nil];

    _mpPlayer3.controlStyle = MPMovieControlStyleDefault;
    [_playerView3 addSubview: _mpPlayer3.view];
    [_mpPlayer3.view setFrame:_playerView3.bounds];

    [_mpPlayer3 play];
}

Then the notification when the video finishes is:

- (void)moviePlayerDidFinish:(NSNotification*)notification {
    [[NSNotificationCenter defaultCenter]
     removeObserver:self
     name:MPMoviePlayerPlaybackDidFinishNotification
     object:nil];

    NSLog(@"Did Finish Notification");

    [_mpPlayer3 stop];

    _mpPlayer3 = nil;
}

This works fine in the simulator, but just shows a black screen in the view I want to display the video in. Another weird thing that happens is that when I do run it in the simulator, I get a bunch of errors such as:

Error loading /System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn:  dlopen(/System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn, 262): Symbol not found: ___CFObjCIsCollectable

I don't know if that has anything to do with the simulator playing the video and the device not, but I thought that I would mention it here.

anthonylawson
  • 761
  • 9
  • 24
  • is the mediaURL locally stored on the iDevice or is it on a remote server? Are you able to connect to that remote server from your device (e.g. using Mobile Safari)? – Michael Dautermann Mar 22 '12 at 21:34
  • This explains that creepy error in the last part of the post: http://stackoverflow.com/questions/6906930/avaudiorecorder-is-broken-on-ios-5 – CodaFi Mar 22 '12 at 21:44
  • The error you quoted is most likely not related to the problem. Are you seeing other error messages, esp. when running on the actual device? – blueberryfields Mar 22 '12 at 21:51
  • @MichaelDautermann It is located on a remote server and it turns out it was a networking issue with a remote access server denying that connection. Thanks for the response! – anthonylawson Mar 23 '12 at 13:15
  • @alawson421 I had a feeling that's what it was. I am glad you sorted it out. – Michael Dautermann Mar 23 '12 at 17:45

0 Answers0