Open In App

Multimedia Framework in Android

Last Updated : 08 Apr, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Android multimedia framework is designed to provide a reliable interface for java service. It is a system that includes multimedia applications,  frameworks, an OpenCore engine, hardware devices for audio/video/ input, output devices also several core dynamic libraries such as libmedia, libmediaplayservices, and so on.

Multimedia Framework in Android

 

The Media Server creates the corresponding media service to the multimedia application. The communication between the media server and Libmedia forms a client-server model. The PV player processes the media data stream by demuxing the media data to separate the video/audio data stream, decode video/audio data, sync video, and audio time, and send the decoded data out.

The Android Multimedia framework is a set of APIs for developers which enables them to create a multimedia application on an android platform. This framework provides support for audio, video, and images, which provides a range of features such as media playback, recording, editing, streaming, etc.

Components of Android Multimedia Framework

1. Media Codec

It provides low-level access to hardware and software codecs for encoding and decoding audio and video data. Format of media codec/format, container, and network protocol supported by the android platform-

  • Container: It is used to store audio file format on a system, where data can be manipulated to reduce the size or change the quality of audio.
  • Audio Format: Any format or codec can be used including the ones provided by android devices. However, it is recommended to use the specified file formats as per devices.
  • Network Protocol: Protocols supported in audio and video playback are RTSP, HTTP/HTTPS progressive streaming, and live streaming draft protocol.

Common media codec formats used in android multimedia applications include

  • H.264: Widely used video codec format that provides high-quality compression and is supported by most modern devices and software.
  • AAC: Popular audio codec format that provides high-quality compression and is widely supported by devices and software.
  • MP3: Well-known audio codec format that provides good compression and is supported by most devices and software.
  • VP9: Video codec format that provides high-quality compression and is supported by some modern devices and software.
  • JPEG: Image codec format that provides good compression and is widely supported by devices and software.
  • PNG: Image codec format That provides lossless compression which is supported by devices and software.

2. Media Player

It is a component in the multimedia framework that provides high-level access to the media playback functionality of Android that enables developers to play audio/video files and stream. It is also a core component of the Android multimedia framework that enables developers to play audio and video files in their applications and provides a simple and flexible API for playing media files from different sources. The sources are local files, network streams, and content providers. Media player supports a wide range of audio and video formats which includes MP3, AAC, WAV, MPEG-4, H.264, etc.

Some key features of media players are:

  • Playback control: This helps in controlling media files by providing a range of methods such as start(), pause(), stop(), and seekTo().
  • Playback State: This feature informs the developer about the playback state by providing functions that are onPrepared(), onCompletion(), and onError().
  • Audio Focus: This feature comes into the picture when multiple audio sources are playing simultaneously and the developer has to manage all of it.
  • Media Streaming: The media player supports streaming media from various sources such as HTTP, RTSP, and RTP so to handle the streaming media developers use setDataSourse() method to set the source for streaming media and use the prepareAsync() method to prepare the media player for asynchronous playback.
  • Media Playback with the surface: To set the surface on which the video should be rendered setSurface() is used. 

3. Media Recorder

Provides high-level access to the media recording functionality of Android which allows developers to capture audio/video data from a device’s microphone and camera. It provides a simple and flexible API for recording media from different sources such as the device’s microphone or camera. Features of the media recorder are:

  • Recording control: This feature provides methods like start(), stop(), and reset()  for controlling the recording of media files.
  • Recording state: This feature enables the user to notify about the state of recording by using methods onInfo() and onError().
  • Audio and Video Sources: This feature provides two methods setAudioSource and setVideoSource() which enable developers to select appropriate audio and video sources for their recordings.
  • Audio and Video Encoding: For video formatting, this feature contains methods such as setOutputFormat() method. setAudioEncoder() and setVideoEncoder() methods are used to select appropriate encoding for audio and video.

4. Surface View

The surface provides a facility to play video content on android devices. It is a subclass of the view class and provides a dedicated drawing surface for applications that need to display video or graphics which are more complicated than simple views. Feature of Surface View:

  • Drawing surface: This feature is used by developers to draw complex graphics or display video frames.
  • Efficient rendering: This is used when developers when designing efficient rendering is needed and provides better performance compared to other View classes when rendering large images or video frames.
  • Compatibility with Android Graphics Framework: It is compatible with OpenGL ES, which is a 3D graphics library that can be used to create advanced multimedia applications.

5. Audio Manager

Controls the overall audio settings such as volume and routing. It allows developers to manage audio settings and control audio playback for various applications and devices. Functions of Audio Manager:

  • Controlling Audio Volume
  • Managing Audio Routing
  • Handling Audio Focus
  • Monitoring audio States

6. Image Reader

Provides access to raw image data from a device’s camera or image sensors. It is a part of the android Camera2 API and is available in Android API level 19 and higher. Function that ImageReader class include:

  • Capturing raw images
  • Processing captured images
  • Configuring capture settings
  • Handling image buffers

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads