Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between AV Foundation framework and Media Player framework

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.

like image 446
Utsav Dusad Avatar asked May 14 '26 00:05

Utsav Dusad


2 Answers

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 :)

like image 127
Ketan Parmar Avatar answered May 15 '26 15:05

Ketan Parmar


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
like image 23
akshay Avatar answered May 15 '26 15:05

akshay



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!