Copy link to clipboard
Copied
Hi
Couple of questions if you are able to help.
1. Is it possible to read ID3 data from a file object, or do you have to create a Sound, and send the file object's nativePath data to the Sound?
eg
public var snd:Sound = new Sound();
public function Sound_id3Example(file:Object) {
snd.addEventListener(Event.ID3, id3Handler);
snd.load(new URLRequest(file.nativePath));
}
2. If it HAS to be via a Sound, and I'm using a recursive function/loop to load files/file data from a directory (and am also trying to read id3 data during that loop), how do you make a recursive function wait until the ID3 event listener has fired before moving on to the next file?
Thanks for taking a look.
It's ideal to use the ID3 system because it will parse it for you. If you're using Adobe AIR you can use the FileStream class to read the file directly and extract the ID3. ID3V1 is at the end of the file, you can read up on the spec here:
http://en.wikipedia.org/wiki/ID3#ID3v1
Set the FileStream.position either 128 (standard) or 227 (extended) bytes from the end of the file and just read the tag. You'll have to parse what is returned via the spec. You can use FileStream synchronous or asynchronou
...Copy link to clipboard
Copied
It's ideal to use the ID3 system because it will parse it for you. If you're using Adobe AIR you can use the FileStream class to read the file directly and extract the ID3. ID3V1 is at the end of the file, you can read up on the spec here:
http://en.wikipedia.org/wiki/ID3#ID3v1
Set the FileStream.position either 128 (standard) or 227 (extended) bytes from the end of the file and just read the tag. You'll have to parse what is returned via the spec. You can use FileStream synchronous or asynchronous. You'd probably want async so your app doesn't freeze on a big directory.
Copy link to clipboard
Copied
Thanks Sinious!
Copy link to clipboard
Copied
You're welcome
Find more inspiration, events, and resources on the new Adobe Community
Explore Now