0% found this document useful (0 votes)
5 views

Tutorial 12 (1)

The document outlines the MediaPlayer framework for mobile application development, detailing its architecture which includes audio/video sources, the MediaPlayer component, and output devices. It lists various sources for sound/audio playback, including local files, raw resources, network streams, and asset files. Additionally, it describes the different states of a MediaPlayer object, such as Idle, Initialized, Prepared, Started, Paused, Stopped, Playback Completed, Error, and End, particularly focusing on the states involved when music is played to completion without pause.

Uploaded by

Adib Rusyaidi
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 views

Tutorial 12 (1)

The document outlines the MediaPlayer framework for mobile application development, detailing its architecture which includes audio/video sources, the MediaPlayer component, and output devices. It lists various sources for sound/audio playback, including local files, raw resources, network streams, and asset files. Additionally, it describes the different states of a MediaPlayer object, such as Idle, Initialized, Prepared, Started, Paused, Stopped, Playback Completed, Error, and End, particularly focusing on the states involved when music is played to completion without pause.

Uploaded by

Adib Rusyaidi
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/ 2

WIA2007 Mobile Application Development

Semester 1, Session 2024/2025

Tutorial 12 (Sound and Audio)

1.​ Draw the general architecture framework for MediaPlayer and explain the framework.

MediaPlayer Framework:

[Audio/Video Source] → [MediaPlayer] → [Audio/Video Output]

Audio/Video Source: The source of the media (e.g., local file, network stream).

MediaPlayer: The core component that manages playback, including states like playing, paused,
and stopped.

Audio/Video Output: The device's speakers or display where the media is played.

Explanation: The MediaPlayer class in Android provides methods to control playback (e.g., start,
pause, stop) and manage the lifecycle of audio/video playback. It handles decoding, buffering,
and rendering media files.

2.​ List the possible sources of the sound/audio playback in a mobile application.

Local Files: Audio files stored in the device's internal or external storage.

Raw Resources: Audio files stored in the res/raw folder of the app.

Network Streams: Audio streams from online sources (e.g., radio, podcasts).

Asset Files: Audio files stored in the assets folder of the app.

3.​ How many states are available in a MediaPlayer object? List all states.

The MediaPlayer object has the following states:

Idle: The MediaPlayer is created but not initialized.

Initialized: The MediaPlayer is initialized with a data source.


Prepared: The MediaPlayer is ready to start playback.

Started: The MediaPlayer is playing audio/video.

Paused: The MediaPlayer is paused but can resume playback.

Stopped: The MediaPlayer is stopped and must be prepared again to restart.

Playback Completed: The MediaPlayer has finished playing the media.

Error: An error has occurred during playback.

End: The MediaPlayer is released and can no longer be used.

4.​ What are the states involved when music is played and completed (without pause)?

When music is played and completed without pause, the following states are involved:

Idle: MediaPlayer is created.

Initialized: MediaPlayer is initialized with the audio source.

Prepared: MediaPlayer is prepared for playback.

Started: MediaPlayer starts playing the music.

Playback Completed: MediaPlayer finishes playing the music.

End: MediaPlayer is released after playback is complete.

You might also like