radio streaming without MPMoviePlayerController - ios

i am currently doing a small radio shoutcast for android and ios with kony.
everything is fine with android but for ios, i am creating a library to play the shoutcast.
Unfortunatly, it seems that the player of MPMoviePlayerController need to be set as a subview to work and i am unable to do that.
does anybody know an other solution to play a shoutcast on IOS?

I don't know about shoutcast but I imagine its similar to SoundCloud in which you use the API to parse the stream URL? If I'm right in thinking that then you simply need to put the URL into an NSURL and make sure to tell the MPMoviePlayerController the source, like so...
radioPlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:YOUR_SHOUTCAST_STREAM_URL]];
radioPlayer.movieSourceType = MPMovieSourceTypeStreaming;
Then simply play
[radioPlayer prepareToPlay];
Hope that helps :)

Related

Playing live streaming video apart from using MPMoviePlayerController

I have an issue (audio issue) playing live streaming video using MPMoviePlayerController for different reason My existing query for that related to VideoCore
[MPMoviePlayerController alloc] initWithContentURL:url]
My question here is, Is there any other approach that we can use for playing live streaming video apart from using MPMoviePlayerController in iOS? Please suggest.
Thank you
Try playing with AVPlayer
Here is the documentation from apple to it.
Here is the example apple provided for it.
Is not as simple as MPMoviePlayerController but it give you more control over it.
Happy coding.

buffer video before playing it on iphone

I'm doing some testing which during I would like to:
- Take a video that is in the app folder
- load that video to memory (buffer it)
- play the bufferd frames from the memory
All made on iPhone
Actually,
I would like to play a video from memory.
(I also want to load the video to memory by frames).
I hope it clear enough.
How can I accomplish this?
Tnx
EDIT:
Maybe I can point my question a little more..
I have a server that streams video via UDP (let's say that for the simuloation I'm using VLC to stream via UDP).
What do I have to do and implement in order to get the UDP stream from VLC and display it on the screen of my I device (of course i'm talking about writing code and not using VLC streamer :-) ).
Hope that's better and that I'll get some answers now.
Tnx
A video has to be buffered only if you receive the video from a server over internet via packets/Streams.
Else you can just play the video using below code:-
NSURL *url = [NSURL URLWithString:[[NSBundle mainBundle] pathForResource:#"yourVideo" ofType:#"yourVideoType" inDirectory:#""]];
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:url];
[[player view] setFrame:[self.view bounds]];
[self.view addSubview:[player view]];
[player play];
[player release];
You can implement the notification MPMoviePlayerLoadStateDidChangeNotification, if you are playing the videos after fetching over some data service.(GPRS,2G, Internet.)

MPMoviewcontroller and AVPlayer with custom control

Hi sorry for this old question. I have tried to research but still have no solution :(.
I need to implement a video controller with my own control buttons. Base on apple example
I use MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:url];
player.controlStyle = MPMovieControlStyleNone; and add my own layer over player.view. There is a problem with my seekForward function. I can not set player.currentPlaybackTime = player.duration (when user press seekForward until reaching the end of the movie). I want to switch to AVPlayer but there is another issues. How can I custom with my own button?. Please help.
I have the same issue with MPMoviePlayerController. Also We can't add more than one MPMoviePlayerController in a same view. For this, I have created a custom player using AVPlayer having basic features. You can download it from my github account HRVideoPlayer. Let me know if you want more detailed version. I have built my own video player having all functionalities like Seeking, volume control, brightness control, replace currentItem, Repeat and shuffle.

Streaming audio and video into IOS app

I am creating an iPhone app on Xcode with build in video and music, the trouble is I want to keep the whole app below 20MB
I've compressed the videos to a OK standard but I'm still over the 20MB
Is there a way I can just stream the videos from a server, so when I click on my video / Audio button in the app it plays like it was saved within the app.
Many Thanks
Try this:
MPMoviePlayerViewController *movieView = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:#"http://movieurl"]];
[self presentMoviePlayerViewControllerAnimated:movieView];
don't forget to import MediaPlayerFramework
If you need more control over streaming, playback or the view itself, see MPMoviePlayerController Class Reference

iPad Movie Player Problem

I am playing mp4 files in iPad using MPMoviePlayerController. I have a view connected in IB to play the video files. The problem is that if one of the files is audio-only, it plays fine, but then videos that play after the audio file do not show the play/pause/seek controls.
I am doing this to initialize the view:
self.theMovie = [[MPMoviePlayerController alloc] init];
[self.viewForMovie addSubview:theMovie.view];
Has anyone seen this behavior or have an idea how I can get the video controls to reappear?
Thank you!
You can set the control type with
self.theMovie.controlStyle=MPMovieControlStyleDefault
These are the available options:
MPMovieControlStyleNone
MPMovieControlStyleEmbedded
MPMovieControlStyleFullscreen
MPMovieControlStyleDefault
Details here: http://developer.apple.com/library/ios/#documentation/mediaplayer/reference/MPMoviePlayerController_Class/Reference/Reference.html

Resources