Is there a music player that has playback controls built in (like MPMoviePlayer) but for audio?
Why don't you go with MPMoviePlayerController, for the audio files also? There you can play with the controls, view, frame etc.
It should be relatively simple to implement custom controls for AVAudioPlayer located in the AVFoundation framework. It has pre-made methods for play, pause, and stop, and audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag to handle playlists. You should give it a look.
Apple provide a example 'avTouch' that can be use as reference
Related
i have implemented Custom Video Player feature in my Application that will used to play online videos now i want to implement video buffering feature i am searching for it but not getting proper solution.
So can anyone guide me please.
look into the AVPlayer + AVPlayerLayer classes.
load AVPlayer with the URL of the video.
give it some time to buffer the video before calling the playing method, maybe like this:
[self performSelector:#selector(play:) withObject:nil afterDelay:10.0];
I think MPMoviePlayerController by default supports the streaming feature. Why don't you try that.
I'm developing a teaching app playing video animations with no sound.
I would like to prevent the movie player from stopping other audio sessions (such as the iPod) when the video is launched.
Is there any way to indicate the iOS the video has no audio or play in mute mode?
Thanks in advance for your help!
You can always detect if the music is playing and and resume it right way after the movie started playing.
Detecting player state
[MPMusicPlayerController iPodMusicPlayer] playbackState]
Resume
[[MPMusicPlayerController iPodMusicPlayer] play];
I think maybe something like this
UInt32 allowMixing = YES;
AudioSessionSetProperty(kAudioSessionProperty_OverrideCategoryMixWithOthers, sizeof(allowMixing), &allowMixing);
AudioSessionSetActive(YES);
should do the the trick.
Keep in mind, you'll need to add the AudioToolbox library to your application, and add:
#import <AudioToolbox/AudioToolbox.h>
to your classes imports in order to use the above code.
It should allow your app's sounds to mix with the other app's sounds in the background. In this case, since your app is silent, it will just allow background sounds to keep playing.
Hope it helps!
Is it possible to play some audio files while my movie is playing. I don't want it to interrupt or pause he movie. Just the audio to play at same time at various predetermined points.
Many Thanks,
-Code
You shouldn't have any problems with it.
If you want to synchronize or delay these players you should use
the code they provide in AvAudioPlayer Class Reference using
playAtTime: method.
Sadly MPMediaPlayback protocol doesn't provide the same method
so exact synchronizing with video is a bit harder task.
EDIT: RoLYroLLs mentions using MPMoviePlayerLoadStateDidChangeNotification to achieve this here and this approach seems promising.
Use two or three Audioplayer at same time . Play that audio when u need it
I am wondering if there is some way to fade in and out audio using AVAudioPlayer in CocoaTouch, with a pause command once the music finishes fading and then a play command once the fading begins. I have heard that one can use NSTimer for this purpose, but I am unsure of the easiest way to accomplish this.
Thanks for any help!
There is a good video tutorial to do this here: Playing a sound, and fading a sound using AVAudioPlayer on iPhone.
I am trying to play music from the user's music library and at the same time record from the built-in microphone. However, as soon as I start recording from the microphone it automatically pauses the music, and I can't find any way to play music and record at the same time. I am using the MediaPlayer framework to play music and the AudioToolbox framework to record from the mic.
Does anyone know if it is possible to play music and record from the mic at the same time, and if so how to do it?
You set your audio session to kAudioSessionCategory_PlayAndRecord
and create an in/out remote io audio unit.
The "loopy" author talks about how to do this here and provides code.
The trailblazing tones of the article are slightly dated now.
You'll need to set your audiosession properties to allow both recording and playback. This might mean that you need to use AudioToolbox for the playback as well as the recording.
try:
Add #import "CDAudioManager.h"to AppDelegate.m and Add [CDAudioManager
initAsynchronously:kAMM_PlayAndRecord]; to - (void)
applicationDidFinishLaunching:(UIApplication*)application