I'm in process of creating radio app (tabbed application) to play http://sample.com/listen.m3u
I have used AVFoundation - AVAudioPlayer, AVPlayer and MPMoviePlayer frameworks thus far.
Experiencing difficulties with volume slider (MPVolumeView) / unable to see volume slider.
My question here is what is the best recommended framework to achieve below tasks?
Play m3u http stream, with play, pause and volume slider?
Use AudioStreamer by mattgallagher which is library for audio streaming. According to your requirement, u should use this.
Refer AudioStreamer library.
Related
We're currently using Linphone library to make VOIP calls and they have their own solution for audio playback. However, we would like to display a visualizer for the audio that Linphone is outputting from within our own app. Is there a way that we can intercept this data (maybe through sample buffering) in order to draw up audio waves/volume meter in the user interface?
AVAudioPlayer or AVPlayer is out of the question since we do not have access to those objects. Is there a solution in place for AVAudioSession or in CoreAudio?
Only if the audio output app is exporting the audio data using Inter-App-audio or Audiobus. Otherwise the iOS security sandbox will hide that audio output from your app.
Audio and video files can be played using AV Foundation framework and Media Player framework.
What is the better choice when I just want to play the media file?
With Media Player framework, we can access the iPod library, and can find and play audio-based media items synced from iTunes on the desktop.
With AVFoundation, we can examine, create, edit, or reencode media files.
When you want to much customization then it is better to use AVFoundation for example AVPlayer. You can totally customize player, audio, sessions etc. so, it is better to use AVPlayer instead of MPMoviePlayerController when lot's of customization requires.
MPMoviePlayerController are very easy to implements compare to AVPlayer.
MPMoviePlayerController:
You have to set controlStyle to MPMovieControlStyleNone, set up Timer because currentPlaybackTime is not KVO compliance
AVPlayer:
AVPlayer has no built in controls, but it has addPeriodicTimeObserverForInterval:queue:usingBlock: that makes handling the current time easily. The nicer thing about periodTimeObserver is that “The block is also invoked whenever time jumps and whenever playback starts or stops”
etc etc.
You can refer this document for more details and better understanding.
Hope this will help :)
Media Player framework:
This high-level framework provides easy access to a user’s iTunes library and support for playing tracks and playlists. Use this framework when you want to integrate audio into your app quickly and when you don’t need to control playback behavior.
AV Foundation:
AV Foundation is an Objective-C interface for managing the recording and playback of audio and video. Use this framework for recording audio and when you need fine-grained control over the audio playback process.
https://developer.apple.com/library/content/documentation/Miscellaneous/Conceptual/iPhoneOSTechOverview/MediaLayer/MediaLayer.html
My app needs to play some music files, like .mp3. I would like to use MPMoviePlayerController because it has implemented all the UI stuff for me, i.e. I do not want to bother implementing progress slide bar and things like this.
I tested to use it to play a .mp3 file and it worked fine but I do not know if it is fine to use it to do this because its name says "movie player" and it seems it is supposed to play a movie. Would apple reject this? Thank you.
For playing audio from a file or memory, AVAudioPlayer is your best option but unfortunately it doesn't support a network stream while MPMoviePlayerController can
From documentation :
An instance of the AVAudioPlayer class, called an audio player,
provides playback of audio data from a file or memory.
Apple recommends that you use this class for audio playback unless you
are playing audio captured from a network stream or require very low
I/O latency.
For the Apple validation I don't think that your application can be rejected because you're using the Media Player Framework to play an audio file. In fact here they explicitly say that you can do just that:
Choose the right technology for your needs:
To play the audio items in a user’s iPod library, or to play local or
streamed movies, use the Media Player framework. Classes in this
framework automatically support sending audio and video to AirPlay
devices such as Apple TV.
Not sure about performance and memory issues though!
Best of luck.
I was wondering if I could mute the sound of an AVPlayer playing a HTTP Live Streaming video?
I've already try several things, like the Apple method to set the volume of an AVPlayer explained here but it works only for local files... (cf. the note at the bottom of Apple documentation).
The similar method explained in this post does not working either.
Is there an solution? I really don't want to mute the sound of the device but only one video while other players could have their own audio (the user could balance audio between players).
Thanks in advance.
iOS 7.0 now provides support for muting the player using
[AVPlayer setVolume:(float)volume]
It also works for HTTP Live Streaming, my app is making extensive use of it.
According to the AVFoundation team, it is impossible to mute or disable a track of an HLS video.
You can mute the entire audio session using MPMusicPlayerController shared instance.
[[MPMusicPlayerController applicationMusicPlayer ]setVolume:0];
I am trying to play a video file with the .mov extension. It is not playing the video in my MPMoviePlayerController. I need to play this type of file in my application. Is it possible to play a video file without using MPMoviePlayerController or UIWebView?
Please anyone suggest me in this issue.
Thanks in Advance
I've never used it directly before, but take a look at the AVPlayer Class Reference.
Under the "Overview", you'll see:
You use an AVPlayer object to implement controllers and user
interfaces for single- or multiple-item playback. The multiple-item
case supports advanced behaviors.
If you look at the AV Foundation Programming guide (linked here), you'll see Apple builds the Media Player upon AV foundation.