Mobile native Wearable native

Media Content

You can get information about media content from the metadata in the content, such as an ID3 or MP4 tag. You can obtain or update data from the media database, which stores metadata for the media files (such as images, videos, and audio) in the device.

Figure: Media content of the device

Media content of the device

The media files are updated using an application (by calling the Content API) or a media scanner. When updating the files in the media scanner, the following limitations apply:

  • SD card insertion and removal: Media files are updated only in the SD card.
  • Rebooting the device: Media files are updated in the internal memory and SD card in the device.

Media content is available to only use the files located in the specific paths. You can get the paths by using the int storage_get_directory(int storage_id, storage_directory_e type, char **path); function. For more information, see the Storage API (in mobile and wearable applications).

The main features of the Content module include:

  • Media content

    To obtain information from the media database, make sure you are connected to it. When the connection is no longer needed, remember to disconnect from the media database.

    You can update database details due to file (or directory) creation or deletion. If a received file (or directory) does not exist in the file system, it is removed from the database.

    You can also set an alarm to get notifications of media database changes.

  • Media information

    You can update the media database due to file creation, deletion, or update in the device.

  • Media bookmarks

    You can manage a bookmark of the video and audio files.

  • Media playlists

    You can add or delete a playlist of the video and audio files, and add media files to a created playlist.

  • Media tags

    You can get tag information of the media files.

  • Media albums

    You can manage an album of the audio file.

  • Mapping MIME types

    You can map a file's MIME types to file extensions and vice versa.

You can also manage downloads, for example, create a new download process, configure the download URL or destination, and launch the process.

Getting Media Information

You can get the media data from the media database using the media_info_foreach_media_from_db() function.

After that, you can get the general information of media and specific information of each media type.

The following tables list the information available about the media files.

Table: General information
Metadata name Description
Media ID ID of the media content
File path Path of the media content
Display name Display name of the media content
Media type The media type of the media content
Mime type Mime type of the media content
Size File size of the media content
Added time The time the media content was added in the database
Modified time The last modification time of the media content
Timeline The time the media content was created
You can use this value to sort the content.
Thumbnail path Path of the stored thumbnail image of the media content
Description Description of the media content
Longitude Longitude of the media content
Latitude Latitude of the media content
Altitude Altitude of the media content
Weather Weather information of the media content
Rating Rating of the media content
Favorite Favorite of the media content
Author The author of the media content
Provider Provider of the media content
Content name Content name of the media content
Title Title of the media content
Category Category of the media content
Location tag Location tag of the media content
Age rating Age rating of the media content
Keyword Keyword of the media content
Is DRM Check flag for DRM content
Storage type Storage type of the media content
Played count Played count of the media content
Played time Last played time of the media content
Played position Last played position of the media content

For metadata of an audio file, call the media_info_get_audio() function with the media handle.

Table: Audio metadata (only for audio files)
Metadata name Description
Media ID Media ID of the audio content
This value is same as the media ID in general information
Album Album information of the audio content
Artist Artist of the audio content
Album Artist Album artist of the audio content
The artist and album artist can be the same.
Genre Genre of the audio content
Composer Composer of the audio content
Year The year the audio content was created
Recorded date The date the audio content was recorded
Copyright Copyright information of the audio content
Track number Track number of the audio content
Bit rate Bit rate of the audio content
Bit per sample Bit per sample of the audio content
The bit per sample is the same as the sample format.
The sample format is the number of digits in the digital representation of each sample.
Sample rate Sample rate of the audio content
Channel Channel information of the audio content
Duration Duration of the audio content

For metadata of an image file, call the media_info_get_image() function with the media handle.

Table: Image metadata (only for image files)
Metadata name Description
Media ID Media ID of the image
This value is the same as the media ID in the general information.
Width Width of the image
Height Height of the image
Exposure time Exposure time of the image
F-number F-number of the image
ISO ISO information of the image
Model Model name of the image
Orientation Orientation information of the image
Date taken The time the image was created
You can get this information from the EXIF tag.
If there is no EXIF tag for the image, set the created time in the file system.
Is burstshot Check flag for a burst shot of the image
The burst shot is a continuous shooting mode.
Burstshot ID ID of a burst shot image
Assign the same ID to the burst shooting mode.

For metadata of a video file, call withmedia_info_get_video() function with the media handle.

Table: Video metadata (only for video files)
Metadata name Description
Media ID The media ID of the video content
This value is same with media ID of general information
Album Album of the video content
Artist Artist of the video content
Album artist Album artist of the video content
Genre Genre of the video content
Composer Media composer of the video content
Year The year the video content was created
Recorded date The date the video content was recorded
Copyright Copyright of the video content
Track number Track number of the video content
Bit rate Bit rate of the video content
Duration Duration of the video content
Width Width of the video content
Height Height of the video content
Go to top