3 Replies Latest reply on Oct 13, 2009 4:52 AM by RossRitchey

    SWF to play mp3 files located on the server

    petersgc

      Hello,

       

      Does anyone know if it is possible to create an SWF file that can play mp3 files directly from the server, without the need for a streaming media server or external JS.

       

      And also for the application to read the current directory its located in and build a playlist based on the files inside.

       

      any information of examples would be greatly appreciated.

       

      Peter.

        • 1. Re: SWF to play mp3 files located on the server
          RossRitchey Level 4

          If you want to have an application on the desktop that can read from the local directories, and load files from a server, then AIR is the way to go.

           

          Essentially, the AIR runtime gives you a bunch of new classes that you can access through Flash to do sophisticated things like local file access, and sometimes connectivity.

           

          As for loading a file from the server without a streaming server - of course you can.  You just load it the same as any other file.

          • 2. Re: SWF to play mp3 files located on the server
            petersgc Level 1

            Hey Ross.

             

            The Application doesnt need to be desktop based.

             

            Say at http://server.domain/files there is an index of mp3 files.

             

            I want an swf file at http://server.domain/files/player.swf

             

            To be able to play the files located in the same directory through the web browser with the possibility of being able to create a play list based on those files.

            • 3. Re: SWF to play mp3 files located on the server
              RossRitchey Level 4

              As for loading and playing the files there is no issue.  Simply load them as you would load any file.  You can even use a relative path if they are in the same folder as the SWF, or a sub-folder that is in the folder with the SWF.

               

              As for looking at the server directory for what files are there, and using them - I know of no way to do this.  That doesn't mean it is impossible, just that I haven't come across a method in my experience.

               

              What I typically do is to archive the list of files in an XML file, and load the XML.  I know, that adds an extra step, and an extra file, but it is the easiest method for approximating what you want to do.

               

              Let me edit this response.

               

              You could use javascript, or a server language to grab the list of files in the directory and pass it into Flash via the ExternalInterface classes.