Playing audio that is retrieved from url - iphone

I am getting a list of songs and its corresponding images from a url.The url is a json url. When i click the list a corresponding song is played. I have used AVFoundation Framework to play the song. Now the issue is that i need to play the next song after the playing of first song is completed. The corresponding images also must load. If i click the next or previous button the corresponding songs must be played. What is the best possible mechanism to attain it???
I have read about the Audio Queues and Audio Units but not sure how to use them. I'll be really helpful if i am provided with some sample code of how to do it.

The easiest thing is to just place an If statement in audioPlayerDidFinishPlaying which is what is called after each sound is played (if playing them with an AVAudioPlayer).
You can also use that to update whatever images you need to as well based on the name.

Related

add more than 1 video player in iphone

Is there any way to add more than 1 video player in a single View? I am getting the .m4v list from server adn have to display that much videos in single page.
It doesnot matter if I play 1 video at a time but which ever video I want must play there itself.
So the videos are placed one below other.
I have tried using mpmoviecontroller but it's drawback is it can have only one instance in the whole applicaiton So if i try to alloc 2 players in a view then the first one does not work and only one player works..
Is there any legal alternate way for the same?
MPMoviePlayerController will allow multiple instances, but only one of them can be playing their movie at any given time.
Please check the link : http://developer.apple.com/library/ios/#documentation/mediaplayer/reference/MPMoviePlayerController_Class/MPMoviePlayerController/MPMoviePlayerController.html
I used AVPlayer class (which also MPMoviePlayerController uses under the hood) to successfully play multiple videos from multiple source.
The process of using it is more involved than MPMoviePlayerController, but I would say it is definitely worth to look at if you want some customized behavior in your player. The official programming guide is a good start.

How to change the notification sound of the iPhone using one coming from the iPod library

I have an alarm app in which I have a tableview where I am accessing all the iPod library songs. I want that when any of this song is selected this song must be set to the notification sound so when the alarm appears the alarm should ring with the sound selected from the iPod library.
ok I got your point. In my similar case i have achieved in following way, but that was somewhat different case. You can try one of the following case.
ONE CASE:
You can do one thing is You can store the URL of iPod Library song in NSUserDefault and pass that URL in didReceivedNotification method to your MPMediaPlayer class.
SECOND CASE
Another case will be copying the selected song in your app's document folder and then use that song for playing. For this you need to take care of previous files and delete them when selected new. This could make your app size somewhat larger.

Combine two audio files together and play them in iPhone

I do not want any code but want to get a reference about my question mentioned below...
There is background music available and there is recording option in my app...
Once I start recording , application records my sound and when play button clicks , It will play the recording along with the background music...
I had use this Link but can not get as I want...
I think there is a mechanism like merging two audio files and make it one before playing....
How can I achieve this by coding... Is there any reference link or any sample code available?
Thnx in advance...
Most people mistake the one instance of AVAudioPlayer as the unit that plays the sound directly, but it doesnt. Mixing is done by the OS, not by the instance of AVAudioPlayer.
With other words:
No one says you can't have more then one AVAudioPlayer.
Create one for you background and let it play. Create another instance of AVAudioPlayer for you recorded sound and let it play. Voila

want to create an audio playlist dynamically by using ".plist" file an then want to play it in iphone in built audio player

I want to create an audio playlist dynamically by using ".plist" file an then want to play it in iphone in built audio player. But during creation of audio list in plist there is no option in "type" to select data type for audio file.
Plz guide any one what approach I should follow ?
I'm not sure if I understood your question correctly. Can you specify what APIs you are using and what you are trying to do with more detail?
As far as Property Lists go, they are very generic so there wouldn't be anything for audio files in particular. You could specify the data type as a string.
How to approach this: First of all, you need to read the list into an NSArray and use that to generate a table view with your track listing (use tableView:didDeselectRowAtIndexPath: to start playing a track upon the user selecting it). To play a track use AVAudioPlayer.

How to play next video in MPMoviePlayer?

I have implement an application.In which there is list of videos.when user touch on the video then video play in MPMoviePlayer.But when video is finished then i want to play another video automatically.Is it possible?
Yes. Do you want it to play another one randomly? You could do that. Or do you have an NSArray that contains all the different MPMoviePlayer URLs to play in order? If you do, then loop through the array objects and play each. You will have to have a MPMoviePlayerPlaybackDidFinishNotification to know when each videos finish so you can start the next one.