0% found this document useful (0 votes)
5 views11 pages

Multi

Uploaded by

Sadhana Ganesan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views11 pages

Multi

Uploaded by

Sadhana Ganesan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

SNS COLLEGE OF TECHNOLOGY

(An Autonomous Institution)


Re-accredited by NAAC with A+ grade, Accredited by NBA(CSE, IT, ECE, EEE & Mechanical)
Approvedy by AICTE, New Delhi, Recognized by UGC, Affiliated to Anna University, Chennai

Department of MCA

MULTIMEDIA

Course: Mobile Application Development


CREDITS: This presentation template was created by
Unit : IV –Sprucing
Slidesgo, Up
including icons byMobile Apps
Flaticon, and infographics &
images by Freepik and illustrations by Stories.
Class / Semester: II MCA / III Semester
Understanding Multimedia files
 MP4 / any other video file is just like a zip file that can package (container format)
video elements, audio elements, and metadata that provide information about the
title or cover art of the video
 Keeping audio and video elements together is usually referred to as multiplexing
 Audio/video, in its raw form, is typically very large that makes it unsuitable for
storage or transport; needs to be compressed with algorithms, referred as codecs
(compressor–decompressor)
 Android platform supports several media codecs and container formats1 to provide
capabilities to play and record a wide variety of audio, video, and images

MPGE-4 container

2-Dec-23 SPRUCING UP MOBILE APPS / 19CA701-Mobile Application Development/Haripriya R/MCA/SNSCT 2


Understanding Multimedia files
 Once media is available in a container, it is ready to play
 To play it, first audio and video elements get separated (de-multiplexed)
 Individual elements are then decompressed back to the raw format using
respective codec
 finally processed by the smart device in order to play
 Decompressing the video elements results in displaying a series of images on the
screen, and
 Decompressing the audio elements results in a sound stream on the speakers of
the device
 Both these elements are synchronized with the help of metadata

2-Dec-23 SPRUCING UP MOBILE APPS / 19CA701-Mobile Application Development/Haripriya R/MCA/SNSCT 3


Introduction

 Android provides multimedia capabilities to developer via APIs


 With API, Build apps with features that require interacting, recording,
playing, and storing audio, video, and image elements
 Media file may be stored on the device itself as an app resource, or
streamed over a network
 A developer may simply use the built-in app of Android to playback the
media, but to get more flexibility and control on playback, in-app
mechanism comes handy.
 In-app mechanism is implemented using MediaPlayer API, which is pivotal
to audio and media playback

2-Dec-23 SPRUCING UP MOBILE APPS / 19CA701-Mobile Application Development/Haripriya R/MCA/SNSCT 4


In App Mechanism

 Built-in app of Android is available to playback the media, but to get more flexibility
and control on playback, in-app mechanism comes handy
 in-app mechanism is implemented using MediaPlayer API
 use an implicit Intent to start the intended music player app
 The setDataAndType() method is used to set the data source and the type of audio
Intent i = new Intent(Intent.ACTION_VIEW);
Uri uri = Uri.parse(“http://www.mobmusicstore.com/music.mp3”); Playing audio file
i.setDataAndType(uri,“audio/*”);
startActivity(i);
Intent i = new Intent(Intent.ACTION_VIEW);
Uri uri = Uri.parse (“http://www.mobmusicstore.com/video.mp4”);
Playing video file i.setDataAndType(uri,“video/*”);
startActivity(i);

2-Dec-23 SPRUCING UP MOBILE APPS / 19CA701-Mobile Application Development/Haripriya R/MCA/SNSCT 5


In-app Mechanism

 MediaPlayer API is the


underlying engine to retrieve,
decode, and playback the
media elements
 MediaPlayer object behaves
as a state machine and has its
own life cycle and states

2-Dec-23 SPRUCING UP MOBILE APPS / 19CA701-Mobile Application Development/Haripriya R/MCA/SNSCT 6


In-app Mechanism

 idle state is the first state , player object gets into, as soon as it is created
 initialized state is to set the data source – a file path or an HTTP URL of the
media stream. setDataSource() method is used to achieve this
 media stream needs to be fetched and decoded so that it can be prepared
for playback by using prepareAsync() during prepared state
 Once it is prepared, can be started using start(), followed by play() to
playback the media stream
 The media stream can now be paused or stopped by calling pause() or stop()
 call release(), once the MediaPlayer object is not required anymore, which
takes it to the end state
 An invalid method call from any state may result in errors and exceptions
2-Dec-23 SPRUCING UP MOBILE APPS / 19CA701-Mobile Application Development/Haripriya R/MCA/SNSCT 7
In-app Mechanism

 key life-cycle methods and states of the MediaPlayer object are


listed

2-Dec-23 SPRUCING UP MOBILE APPS / 19CA701-Mobile Application Development/Haripriya R/MCA/SNSCT 8


MediaPlayer mediaPlayer = MediaPlayer.create(this,Uri.parse (“http://www.mobmusicstore.com/music.mp3”));
if(mediaPlayer==null)
{
Toast.makeText(this, “Unable to create Media player”, 4000).show();}
else
Toast.makeText(this, “Playing song”, Toast.LENGTH_LONG).show();
mediaPlayer.start();
app requires an INTERNET permission,

<uses-permission android:name=“android.permission.INTERNET”/>
<uses-permission android:name=“android.permission.WAKE_LOCK”/>

2-Dec-23 SPRUCING UP MOBILE APPS / 19CA701-Mobile Application Development/Haripriya R/MCA/SNSCT 9


MediaRecorder API

MediaRecorder API

2-Dec-23 SPRUCING UP MOBILE APPS / 19CA701-Mobile Application Development/Haripriya R/MCA/SNSCT 10


REFERENCES

 Anubhav Pradhan, Anil V Deshpande, “Composing Mobile


Apps using Android”, Wiley Edition, 2014

 http://www.dre.vanderbilt.edu/~schmidt/android/android-
4.0/out/target/ common/docs/doc-comment-
check/guide/topics/graphics/2d-graphics.html

 https://developer.android.com/guide/topics/graphics/drawabl
e-animation

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy