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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

New Feature: Audio and Video


Reply


150 Posts   26064 Views

Avatar
Andrew Houle

Community Member, 133 Posts

3 June 2009 at 2:13am

Hi Shawn, to get the player to work, try:

<% control Attachment %>
$Player(400,300)
<% end_control %>

Has anyone else had issues using $VideoPopup to make a thumbnail that links to a shadowbox popup? It works perfectly most of the time, but in some setups the browser attempts to download the file instead of opening the popup to play the video. Any ideas?

Avatar
Shawn Parr

Community Member, 60 Posts

3 June 2009 at 2:24am

Andrew,

That works just fine, but if you try to put any variables into the Parenthesis (i.e. so that you can set the player size within the CMS on a per video basis), it breaks.

That is why I call the control parent, so that I can get those variables.

Avatar
Andrew Houle

Community Member, 133 Posts

3 June 2009 at 2:27am

hmm, yeah, I don't think you can break out of the attachment control loop. Do you need the variables to come from the parent?

Avatar
Shawn Parr

Community Member, 60 Posts

3 June 2009 at 2:35am

Well, the variables are currently being set in my DataObject item. I create a class Video that extends DataObject, and add DB entries for height and width.

I've tried calling them without calling parent, but I assume since we go into control Attachment they are now a parent item.

I'm not sure how I would add those attributes to the Attachment itself. I suppose I would have to create a custom class that extends file? And put them in there? Then how do I add fields to my CMS popup to populate that data? Sorry if that seems to be a noob question, but I'm still wrapping my head around some of this dataobject stuff.

Avatar
UncleCheese

Forum Moderator, 4096 Posts

3 June 2009 at 3:48am

Edited: 03/06/2009 3:49am

You can't put variables in template functions. SSViewer does not yet support that. <% control Parent %> will crap itself when in the Attachment control because Attachment doesn't have a parent.

To do some thing like this, you need to put the function in your controller.

function Videos()
{
$videos = new DataObjectSet();
foreach($this->Attachments() as $att) {
$att->Video = $att->VideoPopup($this->VideoWidth, $this->VideoHeight);
$videos->push($att);
}
return $videos;
}

Something like that..

As for the audio files, go ahead and add your other files types to the $allowed_file_types array in MP3.php. It may work. I don't have much experience with the flash player being used. It used mp3 in the example, but for all I know AAC may work just fine. Let me know the result.

Also, what do you mean when you say "the page errors out?"

Avatar
Shawn Parr

Community Member, 60 Posts

3 June 2009 at 4:11am

Edited: 03/06/2009 4:20am

UC,
<br >
<br >I'll try that in a bit. As far as the error, it is the standard grey and Blue page error Silverstripe throws up (Website Error, there has been an error, etc.)
<br >
<br >And in the SS debug log I get:
<br >
<br >

[02-Jun-2009 11:09:28] Error at sapphire/core/Object.php line 133: Object::__call() Method 'forTemplate' not found in class 'File' (http://astest/shawn/academicservices/new-videopage/?stage=Live)

EDIT

I just tried an AAC file. Upload to an existing audio page and it errors out like the above example (exact same error messages with different URLs). When I went into the database and forced the AAC file to the MP3 class rather than File, the player appears, but the file does not play. I'm guessing there are some limitations in the player, which is what it is. For now I'll only allow mp3 files on that page type. I'll try to do more testing with other files (different bitrates and such, it was a 256kbps file I had at hand, maybe 128kbps max or some such). I just need to make our training materials clear that MP3 is the format to use on this type of page.

Avatar
UncleCheese

Forum Moderator, 4096 Posts

3 June 2009 at 5:02am

Oh, right. I need to update the handleswfupload() function, too, to include AAC, etc in the upgrade list.

Avatar
UncleCheese

Forum Moderator, 4096 Posts

3 June 2009 at 9:33am

Try it with the latest build, Shawn. Added AAC and AIFF to the list.