Jump to:

23486 Posts in 18995 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » MP3 files in single audio player (xml/ playlist)

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1301 Views
  • CHD
    Community Member
    218 Posts

    MP3 files in single audio player (xml/ playlist) Link to this post

    So i've got audio files playing fine on my site (http://www.silentrepublic.com/mp3/) but i want to install a single player now with the ability of adding a playlist. but im a bit rubbish with the real technical side of this stuff!

    here's what i have so far (thanks to Uncle Cheese)


    class AudioFile extends DataObject {

    static $db = array (
    'AudioTitle' => 'Text',
    'Description' => 'Text'

    static $has_one = array (
    'AudioPage' => 'AudioPage',
    'File' => 'MP3'

    public function getCMSFields() {
    $f = new FieldSet (
    new Textfield('AudioTitle'),
    new TextareaField('Description'),
    $u = new FileUploadField('File')
    return $f;


    class AudioPage extends Page {

    static $has_many = array (
    'AudioFiles' => 'AudioFile'

    public function getCMSFields() {
    $f = parent::getCMSFields();
    $f->addFieldToTab("Root.Content.Audio", new FileDataObjectManager($this));
    return $f;
    class AudioPage_Controller extends Page_Controller {}



    class MP3 extends File
       static $allowed_file_types = array (

       private static $player_count = 0;
       public function Player()
          return $this->customise(array(
             'SWFLink' => Director::absoluteURL('dataobject_manager/code/mp3/player.swf'),
             'MP3Link' => Director::absoluteURL($this->URL),
             'Count' => self::$player_count
       public function forTemplate()
          return $this->Player();



    <% require javascript(dataobject_manager/code/mp3/audio-player.js) %>

    <object type="application/x-shockwave-flash" data="$SWFLink" id="audioplayer1" height="24" width="290">
       <param name="movie" value="$SWFLink">
       <param name="FlashVars" value="playerID={$Count}&amp;soundFile={$MP3Link}">
       <param name="quality" value="high">
       <param name="menu" value="false">
       <param name="wmode" value="transparent">


    <div id="ColumnLeft" class="typography">

    <% control AudioFiles %>
    <% end_control %>

    now can anybody please hep me turn this into a playlisted audio player somehow?
    i imagine it will need to be turned into an xml somehow? i think i can figure out how to change the mp3 file location to an xml location, but then how do i auto generate the xml feed using dataobjectmanager on uploads??

    hope this makes sense!

    thanks so much for any help in advance

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.