Reputation: 58067
Im looking to stream YouTube videos to an iOS app. Are there any frameworks or libraries to do so? can AVFoundation do this? Some other Apple framework or third-party library? (Matt Gallagher's AudioStreamer doesn't support video, as far as I know.)
Edit:
Would MPMoviePlayerController
work?
Upvotes: 2
Views: 4548
Reputation: 501
If you choose using ffmpeg, then take a look at kxmovie project. It's movie player for iOS using ffmpeg and OpenGLES. Now the project at stable stage and you may try to use it.
Upvotes: 0
Reputation: 161
You should use ffmpeg library, as this library can connect any streaming server (supporting rtsp, mms, tcp, udp ,rtmp ...) and then draw pictures to the screen.. (for drawing you can use opengles or uiimage also works)
First of all, use avformat_open_input to connect to your ip address then use avcodec_find_decoder & avcodec_open2 to find codecs and to open them (you should call them for both audio & video)
Then, in a while loop read packets from server by using av_read_frame method When you get frame, if it is audio then sent it to AudioUnit or AudioQueue, if it is video, then convert it from yuv to rgb format by using sws_scale method and draw the picture to the screen.
That's all.
look at this wrapper also (http://www.videostreamsdk.com), it's written on ffmpeg library and supports iOS
Upvotes: 1
Reputation: 22334
Check out YouTube official dev pages for information on playing back YouTube content with Objective-C on how to do this. Basically, the documentation suggests using a UIWebView
to handle the video playback.
Upvotes: 3