Jump to:

7940 Posts in 1543 Topics by 946 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: 24700 Views
  • Andrew Houle
    Avatar
    Community Member
    132 Posts

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

    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?

  • Shawn Parr
    Avatar
    Community Member
    60 Posts

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

    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.

  • Andrew Houle
    Avatar
    Community Member
    132 Posts

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

    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?

  • Shawn Parr
    Avatar
    Community Member
    60 Posts

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

    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.

  • UncleCheese
    Avatar
    4085 Posts

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

    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?"

  • Shawn Parr
    Avatar
    Community Member
    60 Posts

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

    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.

  • UncleCheese
    Avatar
    4085 Posts

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

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

  • UncleCheese
    Avatar
    4085 Posts

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

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

    24700 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.