Get and inspect media assets; queue media for playback and customize playback behavior; edit and combine assets; import and export raw media streams.
The AVFoundation framework provides classes for the inspection, playback, editing, and exporting of audiovisual media assets. Use these classes if you want to:
Retrieve media assets for playback, or gather information about an asset.
Play audio and video media assets.
Combine, edit, and remix audio and video assets from multiple sources.
Obtain the media data of an asset, or write media data to a new file of a specified type.
Transcode the contents of an asset to create a new representation.
Assets are the building blocks for media players, and they provide a representation of a media resource. Assets come from many different media resources, such as local or remote media files, or from media streamed using HTTP Live Streaming. Use assets to efficiently retrieve and load audiovisual media in a timely manner. Inspect assets to learn about their properties, such as their duration and playback rate.
You use a player to manage the playback and timing of an asset, for example starting and stopping playback, and seeking to a particular time. A player manages the playback of a single media asset at a time. A queue player manages the queuing of media assets played sequentially. To play an asset, you need its counterpart in the player item. A player item manages the timing and presentation state of an asset played by the player. A player item also contains player item tracks that correspond to the tracks in the asset. You direct the output of a player to a specialized Core Animation layer, a player layer, or a synchronized layer.
With AVFoundation you can create new representations of an asset in several ways. Use a composition to combine multiple audio and video assets into a new, composite asset. Use an export session to re-encode an existing asset into a format defined by one of many commonly used presets. If you need more control over the transformation, use an asset reader and asset writer in tandem to convert an asset to a new representation. You use an asset writer to create assets from media such as sample buffers or still images.