Multimedia Capture & storage. Introduction A rich set of API for recording of audio & video. A developer has two choices  launch the built-in app using.

Slides:



Advertisements
Similar presentations
- Rohit Vobbilisetty. What is the Camera API Capture Photos Capture Videos Camera API - Android2.
Advertisements

SETTING UP A PROJECT Adobe Premiere Pro CS6. Getting started… Adobe Premiere Pro project file stores links to all the video and sound files-aka…clips.
Cosc 5/4730 Multimedia Part 1: Audio media. PLAYING AUDIO Android android.media.
Group 8: Dylan Lentini (AE), Mandy Minuti (WSE), Jean Paul Galea (TL)
Cosc 5/4730 Android media Part 2: Pictures and Video.
Implementation of an Android Phone Based Video Streamer 2010 IEEE/ACM International Conference on Green Computing and Communications 2010 IEEE/ACM International.
Android Security. N-Degree of Separation Applications can be thought as composed by Main Functionality Several Non-functional Concerns Security is a non-functional.
Cannon Game 1 Fall 2014 CS7020: Game Design and Development.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
EPOCH 1000 File Management Data Logging and Reporting
CS371m - Mobile Computing Audio.
Today’s Agenda Bill Presentment Overview Demo. Tailoring Your Invoices with Oracle’s Bill Presentment Architecture March 7, 2005.
ActEyes IP Cam Training Part 2: Basic Camera Features.
INTERNATIONAL SUMMER ACADEMIC COURSE UNIVESITY OF NIS ISAC – Android programming.
Snippet Management The following screens demonstrate how to: 1. Access and view snippets 2. Create a local standard snippet, or a local class snippet 3.
Multimedia.
Chien-Chung Shen Manifest and Activity Chien-Chung Shen
Today:. Colorado Space Grant Consortium Gateway To Space ASEN / ASTR 2500 Class #06 Gateway To Space ASEN / ASTR 2500 Class #06 T-53.
CS378 - Mobile Computing What's Next?. Fragments Added in Android 3.0, a release aimed at tablets A fragment is a portion of the UI in an Activity multiple.
In association with Technion and Qualcomm. Project supervisor: Tatyana Finkel. Technion Israel Institute of Technology.
1 An Extensible Videoconference Tool for a Collaborative Computing Network Junjun He.
CS5103 Software Engineering Lecture 08 Android Development II.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Content Providers & Services.
ANDROID UI – FRAGMENTS. Fragment  An activity is a container for views  When you have a larger screen device than a phone –like a tablet it can look.
Scottsboro City Schools Technology Dept.. Connecting Video Camera to Encoder 1. Power Cable 2. Network Cable (Primary) 3. CVBS-Pb (Yellow - VGA cable)
London April 2005 London April 2005 Creating Eyeblaster Ads The Rich Media Platform The Rich Media Platform Eyeblaster.
This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit
CS378 - Mobile Computing Intents.
CS378 - Mobile Computing Persistence. Saving State We have already seen saving app state into a Bundle on orientation changes or when an app is killed.
Lesson 1 What is Camtasia?. Lesson 2 Editing Objectives After completing the lesson, the student will be able to: Edit a basic recording Camtasia file.
Creating Multimedia Interaction with Windows Media Technologies 7.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Recitation.
Developing the Game User Interface (UI) Lesson 5.
Time Saving Tips & Tricks Enable System Administrator Access to All User Logins In the past, in order for Salesforce.com System Administrators to be able.
Chapter 2 The Android User Interface. Objectives  In this chapter, you learn to:  Develop a user interface using the TextView, ImageView, and Button.
Management Information Systems MS Access MS Access is an application software that facilitates us to create Database Management Systems (DBMS)
SpotOn Game App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
CS378 - Mobile Computing Intents. Allow us to use applications and components that are part of Android System – start activities – start services – deliver.
Android Boot Camp for Developers Using Java, 3E
COMP 365 Android Development.  Every android application has a manifest file called AndroidManifest.xml  Found in the Project folder  Contains critical.
Nilesh Singh Local Data Storage option Android provides several options for you to save persistent application data. - Shared preferences - Creation.
Android – Fragments L. Grewe.
MS Access 2007 Management Information Systems 1. Overview 2  What is MS Access?  Access Terminology  Access Window  Database Window  Create New Database.
HARDWARE INPUT DEVICES GETTING DATA INTO THE COMPUTER.
Camera. Make new project – CameraFun – Give permission to use camera write_external _storage Make two buttons – id takePictureButton – id showLastPicButton.
I. Getting Started with the Interface Microsoft ® Windows ® Movie Maker.
CS378 - Mobile Computing Persistence. Saving State We have already seen saving app state into a Bundle on orientation changes or when an app is killed.
2 Ways to Record PowerPoint From within PowerPoint From within Camtasia Studio.
Cosc 4735 Primer: Marshmallow Changes and new APIs in android 6.0 (api 23)
SOCSAMS e-learning Dept. of Computer Applications, MES College Marampally FILE SYSTEM.
1 Colorado Space Grant Consortium Gateway To Space ASEN / ASTR 2500 Class #13 Gateway To Space ASEN / ASTR 2500 Class #13.
Multimedia. Audio,vedio and Images End user typically refer to vedio/audio using the respective file format MP4 or AVI(audio vedio interleave) Developer.
How to Recover Deleted Photos from Android Cell Phone? Android is keeping on improving their products and make sure to provide the best software service.
CHAPTER 4 Fragments ActionBar Menus. Explore how to build applications that use an ActionBar and Fragments Understand the Fragment lifecycle Learn to.
Services. What is a Service? A Service is not a separate process. A Service is not a thread. A Service itself is actually very simple, providing two main.
Accelerometer based motion gestures for mobile devices Presented by – Neel Parikh Advisor Committee members Dr. Chris Pollett Dr. Robert Chun Dr. Mark.
The Ingredients of Android Applications. A simple application in a process In a classical programming environment, the OS would load the program code.
Mobile Applications (Android Programming)
Android Application Data Storage 1.
CIS 136 Building Mobile Apps
Activities and Intents
User guide for Direct Observations equipment use
The next generation of collaboration
CIS 136 Building Mobile Apps
Cannon Game App Android How to Program
Training Module Introduction to the TB9100/P25 CG/P25 TAG Customer Service Software (CSS) Describes Release 3.95 for Trunked TB9100 and P25 TAG Release.
Mobile Programming Dr. Mohsin Ali Memon.
Preference Activity class
Presentation transcript:

Multimedia Capture & storage

Introduction A rich set of API for recording of audio & video. A developer has two choices  launch the built-in app using intent  use the in-app mechanism (more flexibility & fine grained control).

Built-in app mechanism Recording audio using intent 1 Intent intent= new Intent( MediaStore.Audio.Media.RECORD_SOUND_ACTION); 2 startActivityForResult(intent,REQUEST_CODE); Recording video using intent 1 Intent intent = new Intent (MediaStore.ACTION_VIDEO_CAPTURE); 2 intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY,1); 3 startActivityForResult(intent,REQUEST_CODE);

CAPTURE IMAGE USING AN INTENT Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); String filepath=Environment.getExternalStorageDirectory()+ “/mypicture.jpg”; File myImage = new File(filepath); Uri imageUri = Uri.fromFile(myImage); intent.putExtra(MediaStore.EXTRA_OUTPUT,imageUri); startActivityForResult(intent,REQUEST_CODE);

IN-APP MECHANISM More control & flexibility. MediaRecorder API is used. Steps 1.MediaRecorder object is created & take it to initial state. 2.It is assigned with input sources to record from(using setAudioSource()/setVedioSource()). 3.Define the output format(using setOutputFormat()) & take to data source configured state 4.setAudioEncoder()/setVedioEncoder() for media encoding

5. setVideoFrameRate()/setVideoSize() used to specify the frame rate & output size 6.The setOutputFile() used to set the path of the output file. MediaRecorder object moves to prepared state by calling prepare(). The recording by start() then correspondingly use stop() & release().

The key life-cycle methods & states of the MediaRecorder objects are setAudioSource()/setVedioSource() Initialized setOutputFormat() datasource configured prepare() prepared start() recording stop() Initial release() released

The general steps for creating a custom camera interface for your application are as follows: Detect and Access Camera - Create code to check for the existence of cameras and request access. Create a Preview Class - Create a camera preview class that extends SurfaceView and implements the SurfaceHolder interface. This class previews the live images from the camera. Build a Preview Layout - Once you have the camera preview class, create a view layout that incorporates the preview and the user interface controls you want.

Setup Listeners for Capture - Connect listeners for your interface controls to start image or video capture in response to user actions, such as pressing a button. Capture and Save Files - Setup the code for capturing pictures or videos and saving the output. Release the Camera - After using the camera, your application must properly release it for use by other applications.

Detecting camera hardware If your application does not specifically require a camera using a manifest declaration, you should check to see if a camera is available at runtime. To perform this check, use the PackageManager.hasSystemFeature() method

Android devices can have multiple cameras, for example a back-facing camera for photography and a front-facing camera for video calls. Android 2.3 (API Level 9) and later allows you to check the number of cameras available on a device using the Camera.getNumberOfCameras() method.

Checking camera features Camera.getParameters() Once you obtain access to a camera, you can get further information about its capabilities using the Camera.getParameters() method and checking the returned Camera.Parameters object for supported capabilities. Camera.getCameraInfo() When using API Level 9 or higher, use the Camera.getCameraInfo() to determine if a camera is on the front or back of the device, and the orientation of the image.

Creating a preview class For users to effectively take pictures or video, they must be able to see what the device camera sees. SurfaceView A camera preview class is a SurfaceView that can display the live image data coming from a camera, so users can frame and capture a picture or video.

The following example code demonstrates how to create a basic camera preview class that can be included in a View layout. This class implements SurfaceHolder.Callback in order to capture the callback events for creating and destroying the view, which are needed for assigning the camera preview input.

On most devices, the default orientation of the camera preview is landscape. For simplicity in rendering a camera preview, you should change your application's preview activity orientation to landscape by adding the following to your manifest.

The following example shows how to modify a camera activity to attach the preview class shown in Creating a preview class.

Capturing pictures In your application code, you must set up listeners for your user interface controls to respond to a user action by taking a picture. Camera.takePicture() In order to retrieve a picture, use the Camera.takePicture() method. This method takes three parameters which receive data from the camera. Camera.PictureCallback In order to receive data in a JPEG format, you must implement an Camera.PictureCallback interface to receive the image data and write it to a file.

example

Trigger capturing an image by calling the Camera.takePicture() method. The following example code shows how to call this method from a button View.OnClickListener

Capturing videos MediaRecorder class Video capture using the Android framework requires careful management of the Camera object and coordination with the MediaRecorder class. Camera.lock() Camera.unlock() Camera.open() Camera.release() When recording video with Camera, you must manage the Camera.lock() and Camera.unlock() calls to allow MediaRecorder access to the camera hardware, in addition to the Camera.open() and Camera.release() calls.

Unlike taking pictures with a device camera, capturing video requires a very particular call order. You must follow a specific order of execution to successfully prepare for and capture video with your application, as detailed below. Camera.open() Open Camera - Use the Camera.open() to get an instance of the camera object. Camera.setPreviewDisplay(). Connect Preview - Prepare a live camera image preview by connecting a SurfaceView to the camera using Camera.setPreviewDisplay(). Camera.startPreview() Start Preview - Call Camera.startPreview() to begin displaying the live camera images.

Start Recording Video - The following steps must be completed in order to successfully record video: Camera.unlock() Unlock the Camera - Unlock the camera for use by MediaRecorder by calling Camera.unlock(). Configure MediaRecorder - Call in the following MediaRecorder methods in this order. setCamera() setCamera() - Set the camera to be used for video capture, use your application's current instance of Camera. setAudioSource() setAudioSource() - Set the audio source, use MediaRecorder.AudioSource.CAMCORDER. setVideoSource() setVideoSource() - Set the video source, use MediaRecorder.VideoSource.CAMERA.

Set the video output format and encoding. setOutputFormat() setOutputFormat() - Set the output format, specify the default setting or MediaRecorder.OutputFormat.MPEG_4. setAudioEncoder() setAudioEncoder() - Set the sound encoding type, specify the default setting or MediaRecorder.AudioEncoder.AMR_NB. setVideoEncoder() setVideoEncoder() - Set the video encoding type, specify the default setting or MediaRecorder.VideoEncoder.MPEG_4_SP.

setOutputFile() setOutputFile() - Set the output file, use getOutputMediaFile(MEDIA_TYPE_VIDEO).toString() from the example method in the Saving Media Files section. setPreviewDisplay() setPreviewDisplay() - Specify the SurfaceView preview layout element for your application. Use the same object you specified for Connect Preview.

Stop Recording Video - Call the following methods in order, to successfully complete a video recording: Stop MediaRecorder MediaRecorder.stop() Stop MediaRecorder - Stop recording video by calling MediaRecorder.stop(). MediaRecorder.reset() Reset MediaRecorder - Optionally, remove the configuration settings from the recorder by calling MediaRecorder.reset(). MediaRecorder.release() Release MediaRecorder - Release the MediaRecorder by calling MediaRecorder.release(). Camera.lock() Lock the Camera - Lock the camera so that future MediaRecorder sessions can use it by calling Camera.lock().

Camera.stopPreview(). Stop the Preview - When your activity has finished using the camera, stop the preview using Camera.stopPreview(). Camera.release() Release Camera - Release the camera so that other applications can use it by calling Camera.release().

Releasing the camera Cameras are a resource that is shared by applications on a device. Activity.onPause() Your application can make use of the camera after getting an instance of Camera, and you must be particularly careful to release the camera object when your application stops using it, and as soon as your application is paused (Activity.onPause())

To release an instance of the Camera object, use the Camera.release() method

Saving Media Files Media files created by users such as pictures and videos should be saved to a device's external storage directory (SD Card) to conserve system space and to allow users to access these files without their device. there are only two standard locations you should consider as a developer: Environment.getExternalStoragePublicDirectory(Environment.DIRECT ORY_PICTURES) Context.getExternalFilesDir(Environment.DIRECTORY_PICTURES)

Environment.getExternalStoragePublicDir ectory(Environment.DIRECTORY_PICTU RES) This method returns the standard, shared and recommended location for saving pictures and videos. This directory is shared (public), so other applications can easily discover, read, change and delete files saved in this location. If your application is uninstalled by the user, media files saved to this location will not be removed. To avoid interfering with users existing pictures and videos, you should create a sub-directory for your application's media files within this directory.

Context.getExternalFilesDir(Environment. DIRECTORY_PICTURES) This method returns a standard location for saving pictures and videos which are associated with your application. If your application is uninstalled, any files saved in this location are removed. Security is not enforced for files in this location and other applications may read, change and delete them.

The following example code demonstrates how to create a File or Uri location for a media file that can be used when invoking a device's camera with an Intent or as part of a Building a Camera App.