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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:00:28+00:00 2026-05-25T16:00:28+00:00

I’m trying to stream a video (H264) across a network on iOS. However, I’m

  • 0

I’m trying to stream a video (H264) across a network on iOS. However, I’m getting the video data(NSData) into a buffer through an open socket to the remote server (using serverSocket), so I don’t have a URL to the video that I can use to create an MPMoviePlayerController.
How can I initialize and play the video on my iPhone/iPad in this way?

Here is the part of the code from the client side:

NSString *requestString = textField_.text;
NSString *url = @"http://192.168.3.11:10000";
NSData *myRequestData = [NSData dataWithBytes:[requestString UTF8String] length:[requestString length]];

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:myRequestData];

NSURLResponse *response = nil;
NSError *error = nil;

//send the request and get the response from the server.
NSData *content = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];

#pragma mark--
#pragma mark--test video

//parse the content(NSData) into NSString.
NSString *string = [[NSString alloc] initWithData:content   encoding:NSASCIIStringEncoding];

//and then into NSURL.
NSURL *url2 = [NSURL URLWithString:string];

//so that it can be used by MPMoivePlayerController.
player_ = [[MPMoviePlayerController alloc] initWithContentURL:url2];
[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(movieFinishedCallback:) 
                                             name:MPMoviePlayerPlaybackDidFinishNotification object:player_];
player_.shouldAutoplay = NO;
player_.repeatMode = YES;
player_.view.frame = CGRectMake(10, 10, 300, 300);
[self.view addSubview:player_.view];
[player_ play];

The problem is: I can get data from the content(NSData),which means the server side is ok. But I don’t know how to extract the data from NSData into NSString and then into NSURL so that eventually it could be used by MPMoviePlayerController.

Any help would be appreciated.
Thank you very much in advance!

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

    It looks like you are synchronously downloading the file then playing, this is a horrible way to to do it imho but if thats what you want..

    Once you have a path to your NSData (stored to disk with a recognisable video extension) you can just do this:

    myvideoPlayer = [[MPMoviePlayerController alloc]
    initWithContentURL:[NSURL URLWithString:path]];

    Debugging info for errors is not helpful at all and hours can easily be lost to simple mistakes, so be diligent with your filenames and types.

    Going down the route of a better user experience (async):

    Alternatively you can stream. It is also possible to stream and save to disk at the same time but it’s not particularly easy as you have to handle eofs yourself – kind of funny because MPMoviePlayerController does not have any eof events. I should say that its possible to play mp4’s while the file is still downloading fairly out of the box but doing some cleaver file creation (creating a valid file footer) it is possible to do this with other files. Feel free to ask questions.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to loop through a bunch of documents I have to put
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.