Form:http://www.androidrom.net/application-development/inserting-media-into-the-media-store.html
Inserting Media into the Media Store

Rather than relying on the Media Scanner you can add new media to the Media Store by creating a new ContentValues object and inserting it into the appropriate Media Store Content Provider yourself.

The metadata you specify here can include the title, time stamp, and geocoding information for your new media file, as shown in the code snippet below:

ContentValues content = new ContentValues(3); content.put(Audio.AudioColumns.TITLE, "TheSoundandtheFury"); content.put(Audio.AudioColumns.DATE_ADDED,

System.currentTimeMillisO / 1000); content.put(Audio.Media.MIME_TYPE, "audio/amr");

You must also specify the absolute path of the media file being added.

content.put(MediaStore.Audio.Media.DATA, "/sdcard/myoutputfile.mp4");

Get access to the application'sontentResolver, and use it to insert this new row into the Media Store as shown in the following code snippet.

ContentResolver resolver = getContentResolver();

Uri uri = resolver.insert(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, content);

Once the media file has been inserted into the Media Store you should announce its availability using a broadcast Intent as shown below.

sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri));

RAW AUDIO MANIPULATION

The AudioTrack and AudioRecord classes let you record audio directly from the audio input hardware of the device, and stream PCM audio buffers directly to the audio hardware for playback.

Using the Audio Track streaming mode you can process incoming audio and playback in near real time, letting you manipulate incoming or outgoing audio and perform signal processing on raw audio on the device.

While a detailed account of raw audio processing and manipulation is beyond the scope of this book, the following sections offer an introduction to recording and playing back raw PCM data.

arrow
arrow
    全站熱搜

    戮克 發表在 痞客邦 留言(0) 人氣()