×
Namespaces

Variants
Actions

Archived:Reading ID3 tags of MP3 files in Flash Lite

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

We do not recommend Flash Lite development on current Nokia devices, and all Flash Lite articles on this wiki have been archived. Flash Lite has been removed from all Nokia Asha and recent Series 40 devices and has limited support on Symbian. Specific information for Nokia Belle is available in Flash Lite on Nokia Browser for Symbian. Specific information for OLD Series 40 and Symbian devices is available in the Flash Lite Developers Library.

Article Metadata
Article
Created: manikantan (08 Mar 2009)
Last edited: hamishwillee (14 May 2013)


Introduction

ID3 tags are metadata that describe an MP3 file. These ID3 tags typically contain information on Artist Name, Album, Artist etc. In simple terms, it is the ID3 tags which are used to display these details in popular players such as Winamp or even the mobile's music player. This article describes how to retrieve the ID3 tags of a MP3 file, using Flash Actionscript.

Flash Lite 2.0 supports this property for native Flash sound only. Native sound is a sound in any format that the Flash authoring tool recognizes. Device sounds are formats that are native to a device and played directly by the device like MIDI or MFi. Such formats are extensively used in ringtones on mobile phones. And the other set is where we concentrate in this article, that which supports MP3 files. There are two versions of ID3 tags in MP3 files. ID3 2.0 tags are located at the begining of a MP3 file and are hence available even before the sound data. The ID3 1.0 tags are located at the end of the file, hence can be extracted only after the sound data. Most popular ID3 tags include

COMM - Sound.id3.comment

TALB - Sound.id3.album

TCON - Sound.id3.genre

TIT2 - Sound.id3.songname

TPE1 - Sound.id3.artist

TRCK - Sound.id3.track

TYER - Sound.id3.year

Note: In Flash Lite only those ID3 tags are supported which uses the UTF-8 character set.

Below, we can find the actionscript for reading these ID3 tags. This code snippet shows how to load songname and artist details. In order to retrieve other details, same steps are to followed.

var my_snd:Sound = new Sound();
my_snd.onLoad = function() {
my_snd.start();
trace("DURATION :"+ my_snd.duration);
};
my_snd.onID3 = function():Void {
trace( my_snd.id3.artist + "\n");
trace( my_snd.id3.songname + "\n");
};
my_snd.loadSound("song1.mp3",false);


Note: The onID3 function is called whenever an ID3 tag is encountered during the loading stage of an MP3. Hence, in an MP3 file with both ID3 2.0 and 1.0 tags this function is called twice.

This page was last modified on 14 May 2013, at 06:11.
65 page views in the last 30 days.
×