Working with MP3 files
63
To display the ID3 tags of MP3 files, precede the stream name with
id3:
and define a
callback function to capture the ID3 data. For example, to display the ID3 tag of bolero.mp3:
// displays the ID3 tag of bolero.mp3
mystream_ns.play("id3:bolero");
// callback function to capture the ID3 data. Data will be displayed with
// "info." preceding the data from the tag, for example, info.songtitle.
mystream_ns.onId3 = function(info){
for (i in info){
trace(i + ":" + info[i]);
}
}
About supported versions of ID3 tags
Flash Media Server supports playback of ID3 text tags in UTF-8, UTF-16, and ISO-8859-1
formats and supports ID3 versions 1.0, 2.3, and 2.4. Only tags that contain text data are
supported, such as song title, artist name, comments, and year recorded.
Controlling MP3 files with server-side ActionScript
You can use methods of the server-side Stream object to play back an MP3 file
(
Stream.play()
) and get the length of an MP3 file (
Stream.length()
). For more
information on using these methods with MP3 files, see the
Stream.play()
and
Stream.length()
entries in the
Server-Side ActionScript Language Reference
.
To delete MP3 files using server-side ActionScript, you can use the
Application.clearStreams()
method.
To publish MP3 files, over a stream, or the ID3 tag information associated with MP3 files, use
the
Stream.play()
method, as shown in the following example:
// Set up the server stream
application.myStream = Stream.get("music");
if (application.myStream)
{
// Publish the MP3 file bolero.mp3 to the stream "music"
// Use the mp3: prefix in front of the stream name and specify 0 for the
startTime
parameter to indicate the server should play the recorded
stream bolero.mp3
application.myStream.play("mp3:bolero", 0, -1);
}
Summary of Contents for FLASH MEDIA SERVER 2-DEVELOPING MEDIA
Page 1: ...Developing Media Applications ...
Page 6: ...6 ...
Page 10: ...10 About This Manual ...
Page 36: ...36 Flash Media Server Architecture ...
Page 80: ...80 Debugging and Monitoring Applications ...
Page 106: ...106 Application Development Tips and Tricks ...
Page 114: ...114 ...