Pre-built audio player UI on iphone? - iphone

My boss seems to think there's a way to play audio files via a built-in QT interface that comes up with a modal UI, much like address book framework does.
Also, the mail app pops up a QT modal player to play attached audio files and then hides itself when done.
I've done a good 2 hours of research and I cannot find any pre-built UI for playing audio. I understand that I can do it via AVAudioPlayer, but that still requires I build a custom UI, which is fine, but we're looking for visual familiarity and consistency.
I just now found MPMusicPlayerController, but it appears to only play itunes media, not media from file paths.
So, is there a pre-built audio player UI?

MPMoviePlayerController can also be used to play audio files (although it's not recommended):
MPMoviePlayerController *mPlayer = [[MPMoviePlayerController alloc] initWithContentURL: [NSURL URLWithString:#"http://www.freeaudioclips.com/music1/Sound_Effects/austinmail.wav"]];
// Show Audio player just to test it out
if (mPlayer)
{
[mPlayer play];
}
Read Apple's Documentation and for more details.

Related

Video Buffering implementation

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.

How to play 360º video in iPhone SDK

Before downvote please read the question, I also see other question but doesn't find useful.
I have a requirement in my current app, where i needed to play 360º video (Like Panorama). one app on app store doing same Name "GoPano"
http://itunes.apple.com/ke/app/gopano/id459463884?mt=8
I created a framework over the last 2.5 years, which plays back 360° panoramic video playback on iOS, similar to your requirements.
It is compatible with versions 4.3 up to 6.x at this point.
You can download it at www.panframe.com and try if this is what you are looking for.
The framework supplies a UIView that you can easily add as a child and an asset class which you can connect to the view and which will take care of playing spherical panoramic content.
You can look at the interface I used.
You can use it like this dynamically for example in your UIViewController at runtime:
// initialize an PFView
PFView pfView = [PFObjectFactory viewWithFrame:[self.view bounds]];
pfView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
// set the appropriate navigation mode PFView
[pfView setNavigationMode:PF_NAVIGATION_MOTION];
// add the view to the current stack of views
[self.view addSubview:pfView];
[self.view sendSubviewToBack:pfView];
And when you want to play an 360 video asset (from a file URL) you implement the following:
PFView pfAsset = [PFObjectFactory assetFromUrl:[NSURL fileURLWithPath:filePath] observer:(PFAssetObserver*)self];
if ([pfAsset getStatus] != PF_ASSET_ERROR)
{
[pfView displayAsset:pfAsset];
[pfAsset play];
}
Update:
In case some one wants to use it in cordova apps, you can find plugin here
I found these repos useful when creating my own video 360° player:
https://github.com/hanton/HTY360Player
https://github.com/Aralekk/simple360player_iOS
https://github.com/nomtek/spherical_video_player_ios
The last one is mine, and here is it's description.
Google recently released the CardboardSDK for IOS, which supports 360 video playing.
https://developers.google.com/cardboard/ios/
I found that it is embeded player of GoPano. what they done is play video from Java script and with flex.

iPhone - Streaming audio with MPMoviePlayerViewController

I'm using MPMoviePlayerViewController to stream an audio from the URL "http://ios-audio.q-music.be/audio.m3u8".
Its playing well.
But when I click "Home" button, the app goes into background and stops streaming.
When I start the app again, it starts streaming again.
How can I make my app stream the audio using MPMoviePlayerController when the app goes to background.
Or do I've to use other frameworks?
Well I use https://github.com/mattgallagher/AudioStreamer for streaming audio, It will work in background.
http://digitaldj.net/2010/08/25/ios4-background-audio-revisited/ points to a fork of Matt Gallagher's original AudioStreamer code at http://github.com/DigitalDJ/AudioStreamer, which I can verify does support background audio. That said the original AudioStreamer has been updated this year so I'd imagine it also has implemented background support by now.
Certainly using MPMoviePlayerController to do background audio would be interesting since it presumably opens up the opportunity to support AirPlay directly in an audio streamer application.

Issues playing a video with MonoTouch

I'm having a few issues playing a video in MonoTouch. From what I can find there are two different approaches to take. Both result in the audio being played but no video. I'm betting I'm missing something simple so any help would be great.
Attempt one - taken from MT documentation
moviePlayer = new MPMoviePlayerController(new NSUrl("test.mp4"));
moviePlayer.Play();
Attempt two
moviePlayer = new MPMoviePlayerViewController(new NSUrl("test.mp4"));
this.PresentMoviePlayerViewController(moviePlayer);
Thanks
From looking at the documentation, you need to add the MPMoviePlayerController to a view, otherwise the video will no know where to play.
Your second attempt looks a little better, are you calling the play method on the moviePlayer (note this is a MPMoviePlayerViewController) MPMoviePlayerController (named MoviePlayer)?
For what it's worth, I can get;
moviePlayerController = new MPMoviePlayerViewController(new NSUrl("test.mp4"));
this.PresentMoviePlayerViewController(moviePlayerController);
working with no issues on a sample iPad app. Are you sure your test.mp4 is...
Encoded correctly
Included in the project
Video's build action is set to content
Documentation for MPMoviePlayerController: http://developer.apple.com/library/ios/#documentation/MediaPlayer/Reference/MPMoviePlayerController_Class/MPMoviePlayerController/MPMoviePlayerController.html
Documentation for MPMoviewPlayerViewController:
http://developer.apple.com/library/ios/#documentation/MediaPlayer/Reference/MPMoviePlayerViewController_class/Reference/Reference.html#//apple_ref/occ/cl/MPMoviePlayerViewController

how can we play audio and video together in ipod/iphone?

HI all
i am playing a video(.mp4 format) without sound (i mean it doesn't have sound it is a mute video ) and in the background i am playing an audio file (.mp3 format) when i play my code through simulator it works fine as i want like when i tap on the video it is just mute but behind i am playing the audio so for user it seems that video has this sound but when i installed my code in device and play video than it doesn't work like so it play video but without sound than how can i play an audio and a video together in the above format ?
actually we are not just playing a single video or audio file it just comes from an array by choosing randomly and same for the audio file so we cann't do this i think so any other idea for it ??
Should we use another format for audio aur video for doing this thing ??
thanks for the help
Balraj verma
The problem is that the default Audio Session does not allow audio mixing.
In the Reference Library (Working with Movie Players) they say you should use a mixable category configuration for your audio session, for example the Ambient category. In the Application Delegate:
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
NSError *setCategoryError = nil;
[audioSession setCategory:AVAudioSessionCategoryAmbient error: &setCategoryError];
Apple's documentation states that some audio formats are not suited to be played back simultaneously because of hardware restrictions. See Playing Multiple Sounds Simultaneously for more details.
A solution for you would be to use PCM encoded audio which should allow simultaneous playback.
I would like to add that I managed to play two mp3 audio files at the same time on 3G and 3GS iPhones. Which shouldn't be possible according to documentation but worked for me.
You can rather use the an instance of AvAudioPlayer in a new thread. Use the following link to see how does this work
http://www.mobileorchard.com/easy-audio-playback-with-avaudioplayer/
create an instance of MPMoviePlayer to start playback of videos.
Hope this will work.
You should combine the audio and video using some video editing software like iMovie or Windows Movie Maker. Using the software to "composite" audio and video together is not a good idea and adds additional overhead, synchronization issues, etc.
As far as I know, you can't play AVAudioPlayer and MPMoviePlayer at the same time.