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 6607261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:29:04+00:00 2026-05-25T19:29:04+00:00

I have subfolder called Video in Documents folder. And there is somevideo.mp4 file. I

  • 0

I have subfolder called “Video” in Documents folder. And there is somevideo.mp4 file. I have full path to this file but MPMoviePlayerViewController doesn’t want to play video from local. Here is code:

NSString *path = [[self getVideoFolderPath] stringByAppendingPathComponent:@"somevideo.mp4"];
NSURL *fURL = [NSURL fileURLWithPath:path];
MPMoviePlayerViewController *videoPlayerView = [[MPMoviePlayerViewController alloc] initWithContentURL:fURL];
[self presentMoviePlayerViewControllerAnimated:videoPlayerView];
[videoPlayerView.moviePlayer play];

It doesn’t play. Appears white screen and nothing else. This code works with remote video, when i put URL to website with video file, but local doesn’t play. How to get correct file path to video file?

  • 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-05-25T19:29:05+00:00Added an answer on May 25, 2026 at 7:29 pm

    Are you using iOS prior to 4.3? If so, you need to do this

    [videoPlayerView setContentURL: fURL];
    

    Here is a snippet of code from where I play video from the documents folder. One of the things I would recommend is to avoid some of the autorelease objects. Especially on NSURL when you have viewcontrollers. I know it should be safe but I’ve never found it to be 100%

    if ( [[NSFileManager defaultManager] fileExistsAtPath:fullpathVideoFile] == NO )
        {
        NSLog(@"No video file found");
        return self;
        }
    
    playbackURL = [[NSURL alloc] initFileURLWithPath:fullpathVideoFile isDirectory:NO];
    
    if ( playbackURL == nil )
        {
        NSLog(@"playbackURL == nil");
        return self;
        }
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayerLoadedMovie:) name:@"MPMoviePlayerLoadStateDidChangeNotification" object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayerStartedMovie:) name:@"MPMoviePlayerNowPlayingMovieDidChangeNotification" object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayerFinishedMovie:) name:@"MPMoviePlayerPlaybackDidFinishNotification" object:nil];
    
    [self setContentURL:playbackURL];
    

    In my case, I created a subclass of MPMoviePlayerController (as I generally do with all view controllers) so the references to ‘self’ would be to the MPMoviePlayerController object instance

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

Sidebar

Related Questions

I have a folder called Datas. This folder has a subfolder called Inbox inside
I have a zip file containing a folder structure like main-folder/ subFolder1/ subFolder2/ subFolder3/
I have created a repository that contains a subfolder called 'subrepo'. I then created
I have a folder called Client which contains many subfolders. I want to create
I've an ASP.NET MVC project that has a sub folder called emails. This contains
I have a folder 'Main' [wherein the index.php resides] with a sub-folder called 'Users'.
Sorry if this has been asked elsewhere. I have looked but can't find any
i have a project that is structured with a .net namespace called ViewParts. This,
I have a folder in my webroot called Country. I have an index.html page
I make a folder in public/images called google-markers but when i go to http://myproject/images/google-markers/mymarker.png

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.