Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Playing a stream of bytes on the iPhone MPMoviePlayerController

I have a stream of bytes that represent a movie with H264 video and AAC audio. I got it using an RTMP library (rtmp-dump) and the data is comming through the network to my iOS simulator.

However I have no idea how to show it to the user. The MPMoviePlayerController seems to accept only an URL. Is there a way to play videos by supplying something like a NSPipe or similar to the player?

like image 539
rubenfonseca Avatar asked Jan 08 '11 15:01

rubenfonseca


1 Answers

You could try implementing a custom URL protocol (see NSURLProtocol). Basically you create the protocol and register it, then any in-app requests to load a url having this protocol will be routed to your protocol instance. You'd likely have to mimic the responses that a HTTP server would send for a progressive-download of the file.

This wont work if MPMoviePlayerController uses lower-level CFNetwork calls vs. NSURLConnection to make its requests. This question implies that MPMoviePlayerController DOES make use of NSURLConnectino: How to play movie with a URL using a custom NSURLProtocol?

Also read the URL Loading System docs.

like image 158
TomSwift Avatar answered Sep 20 '22 21:09

TomSwift