Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9132005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:14:18+00:00 2026-06-17T08:14:18+00:00

I just want to load a video file which is in the main bundle,

  • 0

I just want to load a video file which is in the main bundle, this seems pretty simple but for some reason I keep getting an error of the MPMoviePlayerController, I have the following code.

- (void)viewDidLoad{
[super viewDidLoad];

NSString *path = [[NSBundle mainBundle] pathForResource:@"ipad2" ofType:@"mp4"];

self.myPlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:path]];
[self.myPlayer prepareToPlay];

self.myPlayer.movieSourceType = MPMovieSourceTypeFile;
[self.myPlayer.view setFrame:self.view.bounds];
[self.view addSubview:self.myPlayer.view];

[self.myPlayer play];

}

I only get a black screen and the following output:

2013-01-09 13:38:15.686 myVideoApp[1789:907] [MPAVController] Autoplay: Likely to keep up or full buffer: 0
2013-01-09 13:38:15.690 myVideoApp[1789:907] [MPAVController] Autoplay: Skipping autoplay, not enough buffered to keep up.

I also tried adding these notification for playing but is never sent:

[[NSNotificationCenter defaultCenter]
 addObserver:self
 selector:@selector(playVideo:)
 name:MPMoviePlayerLoadStateDidChangeNotification
 object:self.myPlayer ];

And when I print self.myPlayer.loadState I get 0which is undefined loadState.
These is a simple viewController with any other method, and I have these declaration on the .h file:
@property (nonatomic, strong) MPMoviePlayerController *myPlayer;

I`m running on iOS 6, and these happens both in device and simulator

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:14:18+00:00Added an answer on June 17, 2026 at 8:14 am
    NSString *path = [[NSBundle mainBundle] pathForResource:@"ipad2" ofType:@"mp4"];
    

    Have you checked in the debugger that path is not nil?

    self.myPlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:path]];
    

    That’s the wrong way to create a URL from a file path. Use +[NSURL fileURLWithPath:] instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this problem i want to load an iframe, but when you insert
Lets say I want to load an html5 video which is found on a
I know this seems pretty basic, and it should be, but I can't find
I want to load My ACL plugin to the application, and just start working
I want to detect when the document has just started to load, so that
I just want to ask if anybody has done something like this. Basically, it's
I just want to add some extra text on top of input posted from
I want to load youtube video to Android webview using iframe here is my
I've created the function below to create a load of video elements but how
This is loading in all browsers, when I only want it to load in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.