Streaming MP3 using Adobe Flash Media Server
Unlike progressive playing mp3 file from internet streaming mp3 is somewhat different. This article will discuss on streaming Mp3 files using Flash Media Server.
NOTE:
- The mp3 files to be streamed has to reside on the server where Adobe Flash Media Server is installed
Folder Structure for Storing MP3 Files:
For an application to stream MP3 files all the mp3 files should reside inside “applicationname/streams/_definst_/” folder.
Action Script Code:
//create a netConnection object var nc = new NetConnection(); nc.onStatus = function(info) { if(info.code == "NetConnection.Connect.Success") { streamMP3Files(); } } //this function is called once we have connected up to the server function streamMP3Files() { //this is the netStream object that plays the video file ns = new NetStream(nc); //attach the video stream to the video object on the stage vidObject.attachAudio(ns); //play the video file that we put in the directory for the application var filename = "mp3:filename"; //filename is the name of mp3 file without .mp3 extension ns.play(filename); } nc.connect("rtmp://localhost/audiotest/");
Explanation:
- Creating an new NetConnection() object for connecting to Adobe Flash Media Server
- Connected to Adobe Flash Media Server using nc.connect() statement
- After successfully connected to the audiotest application i am calling streamMP3Files function
- To stream MP3 files will have to add “mp3:” to the filename
Folder Structure
Custom Search
Related Post
Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically to your feed reader.












































Hi,
this example very help full for me.
Thank you very much
Regards,
Deepak Tomar