iosurlmpmovieplayercontrollernsurlprotocol

How to play movie with a URL using a custom NSURLProtocol?


As you know,play a movie with MPMoviePlayerController object using

[[MPMoviePlayerController alloc] initWithContentURL: aURL];

now ,i want to achieve a custom NSURLProtocol in which i will decrypt a movie source that had be encrypt by AlgorithmDES. Is that possibility? thanks for giving any ideas.need you help~


Solution

  • UPDATE: I spoke to Apple about this and it's not possible to use MPMoviePlayerController with a NSURLProtocol subclass at the moment!


    Hej,

    I am not sure but it could be possible. I am currently working on something similar but haven't got it fully working. What I have found out is that MPMoviePlayerController interacts with my custom NSURLProtocol subclass BUT it seems to be important to take the HTTPHeaders of the NSURLRequest into account because they define a range of bytes the MPMoviePlayerController needs.

    If you dump them in your NSURLProtocol subclass you will get something like this twice for the start:

    2011-01-16 17:00:47.287 iPhoneApp[1177:5f03] Start loading from request: {
    Range = "bytes=0-1";
    

    }

    So my GUESS is that as long as you can provide the correct range and return a mp4 file that can be played by the MPMoviePlayerController it should be possible!

    EDIT: Here is a interesting link: Protecting resources in iPhone and iPad apps