Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » video not showing in the pages

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
Go to End
Author Topic: 4187 Views
  • Rishi
    Avatar
    Community Member
    97 Posts

    Re: video not showing in the pages Link to this post

    thank you UncleCheese
    you are a genius,i am new in this work so have created lots of mistake,but you helped me a lot,thank you once again,
    Now my flv videos are working fine .
    I have one more problem though it is not related to any module but hope you can help me in finding a solution,
    In my server ffmpeg is working fine and even i can convert and take thumbnail using ffmpeg but in core php code not in silverstripe.
    I tried to find the path of ffmpeg using linux command
    which ffmpeg (which gives the location )
    it gives me this path
    /usr/bin/ffmpeg

    so i have written
    FLV::set_ffmpeg_root('/usr/bin/'); in my _config.php file
    but it is neither converting the avi file into flv nor creating thumbnail.
    i have also tried
    FLV::set_ffmpeg_root('/usr/bin/ffmpeg'); in my _config.php file

    but no success,

    i have created the log file for ffmpeg and when I open it ,i got this written there
    [2010-01-26 10:29:03] /usr/bin/ffmpeg -i /home/equestri/public_html/silverstripe/assets/Uploads/2.avi -ar 22050 -ab 32 -f flv /home/equestri/public_html/silverstripe/assets/Uploads/2.flv
    [2010-01-26 10:29:03] sh: /ffmpeg: No such file or directory

    [2010-01-26 10:29:03] /usr/bin/ffmpeg -y -i /home/equestri/public_html/silverstripe/assets/Uploads/2.flv -an -s 640x480 -ss 10 -an -r 1 -vframes 1 -y -vcodec mjpeg -f mjpeg /home/equestri/public_html/silverstripe/assets/video_thumbnails/2.jpg
    [2010-01-26 10:29:03] sh: /ffmpeg: No such file or directory

    [2010-01-26 10:29:03] /usr/bin/ffmpeg -i /home/equestri/public_html/silverstripe/assets/Uploads/2.avi -ar 22050 -ab 32 -f flv /home/equestri/public_html/silverstripe/assets/Uploads/2.flv
    [2010-01-26 10:29:03] sh: /ffmpeg: No such file or directory

    [2010-01-26 10:29:03] /usr/bin/ffmpeg -y -i /home/equestri/public_html/silverstripe/assets/Uploads/2.flv -an -s 640x480 -ss 10 -an -r 1 -vframes 1 -y -vcodec mjpeg -f mjpeg /home/equestri/public_html/silverstripe/assets/video_thumbnails/2.jpg
    [2010-01-26 10:29:03] sh: /ffmpeg: No such file or directory

    any idea of how to solve this problem...

    One more small help,
    I am uploading a avi file with name as 123.avi but when it is converting it is taking as 2.avi and also trying to create 2.flv,is that the normal procedure or i am again doing some silly mistake?

    Thank you once again for your valuable time and help.

  • Rishi
    Avatar
    Community Member
    97 Posts

    Re: video not showing in the pages Link to this post

    helo UncleCheese
    hope you can help me in this,though the video and flv is working fine in my local system in windows but when i am uploading it in my linux server it is not working i tried to find the ffmpeg using linux command
    which ffmpeg and got the path as /usr/bin/ffmpeg
    then i have written this code in _config.php

    FLV::set_ffmpeg_root("/usr/bin/");

    i have also tried with this coded

    FLV::set_ffmpeg_root("/usr/bin");
    or
    FLV::set_ffmpeg_root("/usr/bin/ffmpeg");

    but nothing is working

    where as i have set the path in my windows system in wamp and its working like a charm

    thank you in advance

  • bebabeba
    Avatar
    Community Member
    192 Posts

    Re: video not showing in the pages Link to this post

    Hi!
    I need something like your work..so I tried your solution but nothing heppen..I have this error when I try to create Video page:

    Fatal error: Class 'FileDataObjectManager' not found in E:\silverstripe\mysite\code\VideoPage.php on line 12

    So I try rewrite tour class in this way..but nothing

    class VideoPage extends Page
    {
    static $has_many = array (
    'Videos' => 'Video'
    );

    public function getCMSFields()
    {
    $fields = parent::getCMSFields();
    $manager = new FileDataObjectManager(
    $this,
    'Videos',
    'Video',
    'Video',
    array('Title' => 'Title', 'Description' => 'Description'),
    new FieldSet(
    new TextField('Title'),
    new TextareaField('Description')
    )
    );
    $fields->addFieldToTab("Root.Content.Videos",$manager);
    return $fields;
    }
    }

    class VideoPage_Controller extends Page_Controller
    {

    }

  • UncleCheese
    Avatar
    4085 Posts

    Re: video not showing in the pages Link to this post

    Ummm.. Have you installed the DataObjectManager module?

  • Rishi
    Avatar
    Community Member
    97 Posts

    Re: video not showing in the pages Link to this post

    Hello bebabeba
    I am giving you the step i have followed to make video working for my site.Its working on cento(LINUX) server where i have ffmpeg working as well as a linux server which do not have ffmpeg,in the second server only flv video are working(it does not convert video).

    First step:
    install swfupload and dataobject_manager
    Second step:
    create the below two pages inside mysite/code
    Video.php
    <?php

    class Video extends DataObject
    {
       static $db = array (
          'Title' => 'Varchar(100)',
          'Description' => 'Text'
       );
       
       static $has_one = array (
          // Make sure this comes first
          'VideoPage' => 'VideoPage',
    /**
    * This relationship could be as simple as 'Video' => 'File' provided
    * FileDataObjectManager::$upgrade_video is true (defaults to true).
    * However, if we know the page will only contain videos, we can simplify things by
    * using a direct relationship to FLV. This will give us the benefit of not having
    * to worry about the allowed_file_types setting.
    *
    * To make this an audio resource, set the relationship to the MP3 class, e.g.
    * 'AudioFile' => 'MP3'. Audio files are also subject to automatic upgrades, however,
    * based on FileDataObjectManager::$upgrade_audio. (true by default).
    *
    */
          'Video' => 'FLV'
       );
       
    }
    ?>

    VideoPage.php

    <?php
    /**
    * Before getting started, be sure to test your FFMPEG installtion by adding:
    * FLV::echo_ffmpeg_test();
    * to your _config.php!
    *
    */

    class VideoPage extends Page
    {
       static $has_many = array (
          'Videos' => 'Video'
       );
       
       public function getCMSFields()
       {
          $fields = parent::getCMSFields();
          $fields->addFieldToTab("Root.Content.Videos", new FileDataObjectManager(
             $this,
             'Videos',
             'Video',
             'Video',
             array('Title' => 'Title', 'Description' => 'Description'),
             new FieldSet(
                new TextField('Title'),
                new TextareaField('Description')
             )
          ));
          return $fields;
       }
    }

    class VideoPage_Controller extends Page_Controller
    {

    }

    ?>

    now make dev/build

    create a template page named as VideoPage.ss and place the page inside your theme/Layout

       <% control Videos %>
          <div class="link">
             <div class="description">
                <h3>$Title</h3>
                <p>$Description</p>
             </div>
             <div class="resource">
              <% control Video %>
             
                 $VideoPopup(200x200 , 400x400)
                
    <% end_control %>            
             </div>
          </div>
       <% end_control %>

    to set the width and length of video you can add the below code in _config.php inside mysite
    FLV::$video_width = 300;
    FLV::$video_height=200;

    this code works fine for me,hope this help you

  • UncleCheese
    Avatar
    4085 Posts

    Re: video not showing in the pages Link to this post

    +1 for the community stepping in and offering support! Thanks, Rishi!

  • Rishi
    Avatar
    Community Member
    97 Posts

    Re: video not showing in the pages Link to this post

    UC what ever i i know about silverstripe is because of you.you have helped me a lot.i feel glad if i can help fellow user of silverstripe

  • mahir
    Avatar
    Community Member
    11 Posts

    Re: video not showing in the pages Link to this post

    Thank you guys that really helped me

    4187 Views
Page: 1 2 3 4 5
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.