Search code examples
iosmedia-playermediacodec

ios: playing video with arbitrary nsinputstream


I would like to pass an NSInputStream into a MPMoviePlayerController, or MPMoviePlayerViewController, or whatever else.

The input stream leverages a protocol that is not supported by Apple's frameworks.

I tried creating a custom NSURLProtocol (which kind of works on a device only (not simulator)), but MediaPlayer tries to cache everything and causes the application to crash when it allocates 250MB. And video never plays.

Any ideas on how to proceed? I know some apps out there do this.

I don't really want to have to build my own media player, but it seems likely, no? Are there any examples of how to do that with only CoreMedia and not FFMPEG (etc)? Codec selection is not important to me - just the ability to play while streaming over a proprietary protocol.

Thanks!


Solution

  • The custom_io branch of kxmovie is exactly what I was looking for. Some of the videos aren't playing perfectly, but it's a start.

    https://github.com/kolyvan/kxmovie/tree/custom_io