Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

New Feature: Audio and Video


Go to End


150 Posts   38453 Views

Avatar
DanStephenson

Community Member, 116 Posts

12 June 2009 at 4:17am

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

Avatar
UncleCheese

Forum Moderator, 4102 Posts

12 June 2009 at 4:55am

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.

Avatar
thrax

Community Member, 32 Posts

17 June 2009 at 1:40am

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 :D

Avatar
UncleCheese

Forum Moderator, 4102 Posts

17 June 2009 at 3:35am

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.

Avatar
thrax

Community Member, 32 Posts

17 June 2009 at 12:02pm

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

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)

Avatar
UncleCheese

Forum Moderator, 4102 Posts

17 June 2009 at 12:39pm

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

Avatar
UncleCheese

Forum Moderator, 4102 Posts

17 June 2009 at 12:47pm

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

Avatar
thrax

Community Member, 32 Posts

17 June 2009 at 12:58pm


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)

Go to Top