Getting video to play in the simulator

So, I got a warning window in my application, and when I click the watch video button, the video should play, but nothing happens in the simulator. I do not want to check this on the device until I get it in the simulator. This is the code below, as far as I can tell, it should work. It reaches the log statement and displays it on the console, but the video does not play. Any ideas?

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex: (NSInteger)buttonIndex{
    if (buttonIndex == 1) {
        NSURL *url = [NSURL URLWithString:@"http://srowley.co.uk/endyVid.mp4"];
        MPMoviePlayerController *player = [[[MPMoviePlayerController alloc] initWithContentURL:url] autorelease];

        //---play movie---
        [player setFullscreen:YES];
        [self.view addSubview:[player view]];
        NSLog(@"Player Should play!");
        [player play]; 
    }
}
+3
source share
1 answer

You need to set the frame to view the player.

    [[player view] setFrame: [self.view bounds]];
+2
source

Source: https://habr.com/ru/post/1768496/


All Articles