Android Multimedia frame support for music player

Source: Internet
Author: User

Here's a look at what the ANDRIOD Multimedia framework supports developers. 1. Mediascannerreceiver This broadcast recipient receives action_boot_completed, action_media_mounted, or Action_media_scanner_scan_ File broadcast when the image, music and video files in the SD card is scanned, because the scan does not affect the user's use, here started a service Mediascannerservice, scan the following file types:/* Audio */addfiletype ("MP 3 ", File_type_mp3," audio/mpeg ");
Addfiletype ("M4A", file_type_m4a, "Audio/mp4");
Addfiletype ("WAV", File_type_wav, "audio/x-wav");
Addfiletype ("AMR", File_type_amr, "audio/amr");
Addfiletype ("AWB", FILE_TYPE_AWB, "AUDIO/AMR-WB");
Addfiletype ("WMA", File_type_wma, "audio/x-ms-wma");
Addfiletype ("OGG", File_type_ogg, "Application/ogg");
Addfiletype ("MID", File_type_mid, "Audio/midi");
Addfiletype ("XMF", File_type_mid, "Audio/midi");
Addfiletype ("RTTTL", File_type_mid, "Audio/midi");
Addfiletype ("SMF", FILE_TYPE_SMF, "Audio/sp-midi");
Addfiletype ("IMY", File_type_imy, "audio/imelody"); /* Video */ Addfiletype ("MP4", File_type_mp4, "Video/mp4"); Addfiletype ("M4V", file_type_m4v, "Video/mp4");
Addfiletype ("3GP", FILE_TYPE_3GPP, "VIDEO/3GPP");
Addfiletype ("3GPP", FILE_TYPE_3GPP, "VIDEO/3GPP");
Addfiletype ("3g2", File_type_3gpp2, "video/3gpp2");
Addfiletype ("3GPP2", File_type_3gpp2, "video/3gpp2");
Addfiletype ("WMV", file_type_wmv, "video/x-ms-wmv");

/* Image */
Addfiletype ("JPG", File_type_jpeg, "image/jpeg");
Addfiletype ("JPEG", File_type_jpeg, "image/jpeg");
Addfiletype ("GIF", File_type_gif, "image/gif");
Addfiletype ("PNG", File_type_png, "image/png");
Addfiletype ("BMP", File_type_bmp, "image/x-ms-bmp");
Addfiletype ("WBMP", File_type_wbmp, "image/vnd.wap.wbmp");

/* Audio Play List */
Addfiletype ("m3u", file_type_m3u, "Audio/x-mpegurl");
Addfiletype ("PLS", File_type_pls, "Audio/x-scpls");
Addfiletype ("WPL", FILE_TYPE_WPL, "APPLICATION/VND.MS-WPL");
Writes to the database after the scan is finished.               Other applications are able to know when the scan operation begins and ends by receiving the action_media_scanner_started and action_media_scanner_finished intent emitted by the mediascannerservice. 2. Mediaprovider for the multimedia information stored in the database, Mediaprovider provides the interface for data access. Mediaprovider inherited ContentProvider, let's take a look at the data query interface: Cursor query (URI uri, string[] projection, String selection, Str Ing[] Selectionargs, String sortOrder); Uri: Indicates the name of the database to query, plus the name of the table, from the mediastore we can find the parameters of the corresponding information, please refer to the development documentation.
Projection: Specifies which columns in the database table are queried, and the corresponding information is included in the returned cursor. NULL returns all information.
Selection: Specifying query criteria
Selectionargs: Is there a parameter in selection? This symbol is where the actual value can be substituted for this question mark. What if selection this? , then this string array can be null.
SortOrder: Specifying the order in which query results are sorted
The following command returns information about all the music files on the external memory card:
cursor cursor = query (MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, NULL,
NULL, NULL, MediaStore.Audio.Media.DEFAULT_SORT_ORDER);

Get the album name of the song in the ID tag: MediaStore.Audio.Media.ALBUM
String album = cursor.getstring (Cursor.getcolumnindexorthrow (MediaStore.Audio.Media.ALBUM));
Please refer to the Mediastore class for other specific parameters.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.