Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » New Feature: Audio and Video

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Go to End
Author Topic: 23592 Views
  • DanStephenson
    Avatar
    Community Member
    115 Posts

    Re: New Feature: Audio and Video Link to this post

    UncleCheese, is the audio and video component for DOM ready to be used in a production environment?

  • UncleCheese
    Avatar
    4085 Posts

    Re: New Feature: Audio and Video Link to this post

    I have one, going on two clients using it in production. I also know of one other user in the forum who is about to launch a site using it. So, it's by no means out of Beta, but it certainly has shown that it will hold up. Just be attentive and aware that it's not an iron-clad codebase yet, and be sure to do plenty of testing before you launch. Everyone's server is different.

  • thrax
    Avatar
    Community Member
    32 Posts

    Re: New Feature: Audio and Video Link to this post

    These new features awesome! I'm wanting to get the mp3 streamer (identical to the demo in the video) up running, but I just can't seem to get anything substantial happening at all!

    Operating from http://doc.silverstripe.com/doku.php?id=modules:dataobjectmanager#introduction the first tutorial code (Testimonials) works fine for me, but the second bunch (Resource) have a syntax error, and eve once that's fixed the furthest it gets is a dbuild, then in the CMS on page creation it fails (you then have to delete the created .php files and rebuild db to get rid of the page.

    My first question is: Is the version of DOM that comes down from the main site up to date enough to stream mp3's as the demo shows? or is it all still in SVN?

    2nd: Would anyone be able to write a tutorial on how to get the mp3 streaming up and running? A major problem I've found with SS is almost every tutorial is written in such a way that they leave out basics steps, and you need to know what you're doing for them to be useful.... I'm unfortunately not a coder but I'm doing my best to learn more and more, and I just need a bit more depth to fill the gaps.

    ps: I've got SS 2.3.1, SWFUpload and DOM all installed etc, it's the code elements I struggle with.

    DOM looks really great, can't wait to get it running

  • UncleCheese
    Avatar
    4085 Posts

    Re: New Feature: Audio and Video Link to this post

    The ZIP file download is pretty outdated. Use the SVN channel to get the most recent stuff. I'm positive the Autdio/Video features are not in the download.

    Here's a quick example of how to do an MP3 page. (Pardon any haphazard syntax errors)..
    AudioPage.php

    class AudioPage extends Page
    {
    static $has_many = array ('AudioFiles' => 'AudioFile');

    public function getCMSFields()
    {
    $f = parent::getCMSFields();
    $f->addFieldToTab("Root.Content.Audio", new FileDataObjectManager(
    $this,
    'AudioFiles',
    'AudioFile',
    'MP3',
    array('Name' => 'Name', 'Description' => 'Description),
    new FieldSet(
    new TextField('Name'),
    new TextareaField('Description')
    )
    ));
    }
    }

    class AudioPage_Controller extends Page_Controller
    {
    }

    AudioFile.php

    class AudioFile extends DataObject
    {
    static $db = array (
    'Name' => 'Varchar(100)',
    'Description' => 'Text'
    );

    static $has_one = array(
    'AudioPage' => 'AudioPage',
    'MP3' => 'MP3'
    );
    }

    AudioPage.ss

    <% control AudioFiles %>
    <h3>$Name</h3>
    <p>$Description</p>
    $MP3
    <% end_control %>

    Run /dev/build

    Now we'll enable drag-and-drop sorting of our audio files, just for fun.

    _config.php

    SortableDataObject::add_sortable_class('AudioFile');

    Let me know how that goes for ya.

  • thrax
    Avatar
    Community Member
    32 Posts

    Re: New Feature: Audio and Video Link to this post

    Thanks UC - The quality of that reply (and speed) was awesome

    Issues:

    Grabbed everything for DMO from the SVN links you posted, made the pages (missing a ' in 'Description) in AudioPage.php ;) just incase anyone copy/pastes and can't find it) - run the db/build and created an AudioPage in the CMS, but it displays this error:

    Fatal error: Class 'FileDataObjectManager' not found in /var/www/mysite/code/AudioPage.php on line 9

    2nd issue is the drag and drop sorting, when that line is in mysite/_config.php the db won't build (I'll grab exact error in a little while)

  • UncleCheese
    Avatar
    4085 Posts

    Re: New Feature: Audio and Video Link to this post

    Dude, that's one messed up error. Did you delete FileDataObjectManager.php?!

  • UncleCheese
    Avatar
    4085 Posts

    Re: New Feature: Audio and Video Link to this post

    Are you running db/build, or /dev/build? The latter is correct. Either, way, that's pretty messed up.

  • thrax
    Avatar
    Community Member
    32 Posts

    Re: New Feature: Audio and Video Link to this post

    Ok, sorted that out.... for some reason a bunch of files didn't copy in :S but that's fixed now.

    using /dev/build now too

    Now when I create Audio Page in the CMS I get the standard popup box with "There has been an error" (this is usually where I get stuck as it's completely indescriptive)

    23592 Views
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
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.