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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:25:49+00:00 2026-06-17T09:25:49+00:00

I have this function to write NSData to document dictionary – – (void)writeData {

  • 0

I have this function to write NSData to document dictionary –

- (void)writeData
{
    NSString *str = @"http://labs.widespace.com/resources/banner/ikea/verkligheten/video.m4v";

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *path = [documentsDirectory stringByAppendingPathComponent:str];
    NSLog(@"%@",path);
    NSLog(@"About to Write Data");
    NSData* data0 = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:str]];
    [data0 writeToFile:path atomically:YES];
    NSLog(@"Writting  Data Completed");
}

Later i read this data and try to play the video using MPMoviePlayerController, but unfortunately this
does not play-

- (void)readData
{
    NSString *str = @"http://labs.widespace.com/resources/banner/ikea/verkligheten/video.m4v";
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,     NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *path = [documentsDirectory stringByAppendingPathComponent:str];
    NSURL* url = [[NSURL alloc] initFileURLWithPath:path];    
    NSLog(@"url:%@",url);

    NSError *error = nil;
    BOOL isReacahble = [url checkResourceIsReachableAndReturnError:&error];
    NSLog(@"isReachable :%i,%@",isReacahble,error);

    BOOL fileExist =  [[NSFileManager defaultManager] fileExistsAtPath:path];

    if(fileExist)
    {
        NSLog(@"File Exist in path");
    }
    else
    {
        NSLog(@"NO File Exist");
    }

    MPMoviePlayerController *moviePlayer=[[MPMoviePlayerController alloc] initWithContentURL:url];
    [moviePlayer prepareToPlay];
    NSLog(@"movie player:%@",moviePlayer);
    [moviePlayer setControlStyle: MPMovieControlStyleFullscreen];
    [moviePlayer.view setFrame:CGRectMake(0, 0,320, 480)];
    [self.view addSubview:moviePlayer.view];
    moviePlayer.shouldAutoplay = YES;   
    [moviePlayer play];
}

When i try to play this it shows following error-

2013-01-17 11:21:07.067 VideoCheck[338:907] [MPAVController] Autoplay: Disabling autoplay for pause
2013-01-17 11:21:07.068 VideoCheck[338:907] [MPAVController] Autoplay: Disabling autoplay
2013-01-17 11:21:07.090 VideoCheck[338:907] [MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 1, on player: 0)
2013-01-17 11:21:07.091 VideoCheck[338:907] movie player:<MPMoviePlayerController: 0x21078250>
2013-01-17 11:21:07.093 VideoCheck[338:907] [MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 1, on player: 0)
2013-01-17 11:21:07.102 VideoCheck[338:907] [MPAVController] Autoplay: Enabling autoplay
2013-01-17 11:21:07.113 VideoCheck[338:907] [MPAVController] Autoplay: Likely to keep up or full buffer: 0
2013-01-17 11:21:07.114 VideoCheck[338:907] [MPAVController] Autoplay: Skipping autoplay, not enough buffered to keep up.
2013-01-17 11:21:07.115 VideoCheck[338:907] [MPAVController] Autoplay: Enabling autoplay
2013-01-17 11:21:07.121 VideoCheck[338:907] [MPCloudAssetDownloadController] Prioritization requested for media item ID: 0
2013-01-17 11:21:07.149 VideoCheck[338:907] [MPAVController] Autoplay: Enabling autoplay

Can someone please run the code and provide some information about what’s happening here??Please someone help me. I am using iOS 6.

  • 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-17T09:25:49+00:00Added an answer on June 17, 2026 at 9:25 am

    In your wrieData method, instead of giving URL name as file, give only the name of the video. Like

    NSString *path = [documentsDirectory stringByAppendingPathComponent:[str lastPathComponent]];
    

    and do the same in readData method too.

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

Sidebar

Related Questions

I have this function: function getScript(src) { document.write('<' + 'script src=' + src +
I have this function: void Log::Write(string logline){ //2011-10-12 13:07:40 correct format time_t rawtime; struct
Hello i have this form filling javascript: function onLine(code,nn) { document.writeform.bericht.value+=code; document.writeform.bericht.focus(); document.writeform.nickname.value+=nn; write1();
I have this function: private void button6_Click(object sender, EventArgs e) { crawlLocaly1 = new
This is a very basic question. I have this script: <script type=text/javascript> function write(){
I have this function which writes content to a text file: function write($text){ fwrite($this->fp,
I have this function write in a CakePHP model: public function getPeopleByName($name){ $this->unbindModel(array('hasMany' =>
I have saved this as an ajax.js file: function sendAjax(type, str) { var xmlhttp;
I am newbie in ruby and regular expressions and I have this function write
I need your help. I have this javascript function to write a message to

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.