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

video not showing in the pages


Go to End
Reply


33 Posts   4826 Views

Avatar
Rishi

Community Member, 97 Posts

26 January 2010 at 1:48am

hello
I am trying to create a video gallery from flv files,when i am uploading the file it is creating the thumbnails but when I am opening the pages it is only showing the title and description but not the file,it is not playing the file and there is no error also.i have used the devlopment mode still i did not got any error.I got the code in this forum provided by UncleCheese, The code for the pages are given below.

Video.php
<?php

class Video extends DataObject
{
   static $db = array (
      'Title' => 'Varchar(100)',
      'Description' => 'Text'
   );
   
   static $has_one = array (
      // Make sure this comes first
   
      'Video' => 'FLV'
   );
   
}
?>

VideoPage.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
{

}

VideoPage.ss
<% control Video %>
$Video (no control needed)
<% end_control %>   

Please help me to run my video gallery
thanks in advance,special request to UncleCheese

Avatar
UncleCheese

Forum Moderator, 4096 Posts

26 January 2010 at 3:04am

That's weird.. You explicitly say "no control needed", but then you put it in a control (???)

Try just $Video

or

<% control Video %>$Player(width,height)<% end_control %>

Avatar
Rishi

Community Member, 97 Posts

26 January 2010 at 3:40am

Edited: 26/01/2010 3:41am

I am sorry typing mistake..the actual code was
<% control Video %>
$Video
<% end_control %>

in the page .ss

I have also tried
<% control VideoThumbnail %>$CroppedImage(50,50)<% end_control %>

but no result,
when I have tried your given code i,e
<% control Video %>$Player(300,200)<% end_control %>

i got title,description and then

Loading.....

but nothing is showing up.

thank you in advance

Avatar
UncleCheese

Forum Moderator, 4096 Posts

26 January 2010 at 3:54am

You might be misunderstanding..

If you just run $MyFLVComponent (in your case $Video), it will run the forTemplate() function on that object. I the case of an FLV object, that will return Player($defaultWidth, $defaultHeight);

So you do not need <% control Video %> in that case. If you use <% control Video %> you're looking for the $Video component ON your Video component, which of course doesn't exist.

Alternatively, you can step into the component using <% control Video %> and then run any number of functions that are in the FLV class, including $Player, $VideoThumbnail, or $VideoPopup.

Therefore your second example of having $Player in the Video control is correct. If you're just getting a "loading" message, you need to check for Javascript errors and make sure "dataobject_manager/code/flv/swfobject.js" is in your source and that the swfobject.embedSWF() function is running correctly.

Avatar
Rishi

Community Member, 97 Posts

26 January 2010 at 8:02am

thanks a lot UncleCheese,its really nice of you ..you have taken so much pain to explain me how to use the FLV functions.
I have tried all your suggest code,but it seems nothing is working.The file you have mention is also present there i'e
dataobject_manager/code/flv/swfobject.js

how to check whether the javascript is working corretly,
i ahve tried firebug it does not gives any error,i tried to check the html source of the resultant page and i found that no player is getting embedded..
the html code of the resultant page is

<!-- template D:/wamp/www/cs_login/themes/blackcandy/templates/VideoPage.ss -->
   
      <div class="link">
         <div class="description">
            <h3>flv</h3>
            <p>flv</p>
         </div>
         <div class="resource">
         
<div id='player-1'>Loading...</div>

            
         </div>
      </div>
   

<!-- end template D:/wamp/www/cs_login/themes/blackcandy/templates/VideoPage.ss -->

I tried to find our in FLV.php page
i may be wrong but i have noticed that in this part of code

public function Player($width = null, $height = null)
   {
      if($width === null) $width = self::$video_width;
      if($height === null) $height = self::$video_height;
      
      self::$player_count++;
      Requirements::javascript('dataobject_manager/code/flv/swfobject.js');
      
//this line
Requirements::customScript(sprintf(

            "swfobject.embedSWF('%s','player-%s','%d','%d','9.0.0','expressInstall.swf',{file : '%s'},{allowscriptaccess : 'true', allowfullscreen : '%s'})",
            $this->SWFLink(),
            self::$player_count,
            $width,
            $height,
            $this->FLVLink(),
            $this->AllowFullScreen()
         )
      );
// this line
      return "<div id='player-".self::$player_count."'>Loading...</div>";
   }

the above 2 points line are not working or may be either of this two line
and self::$player_count part in particular.

ANY suggestion??
thank you once again

Avatar
UncleCheese

Forum Moderator, 4096 Posts

26 January 2010 at 8:42am

At this point, I'd really need a public link to the site to be able to do further testing. It's something really simple, I'm sure.

Avatar
Rishi

Community Member, 97 Posts

26 January 2010 at 3:00pm

Edited: 27/01/2010 6:19pm

thank you UncleCheese
here is the link of the site..

and this is the page it is showing 2 mp3 and 3rd one is a flv

Avatar
UncleCheese

Forum Moderator, 4096 Posts

26 January 2010 at 4:47pm

Umm.. your page has no header or footer. It starts with <div id="primaryContent">. Without a body tag or a head, how can you expect javascript to work?

Looks to me like you put your template in the wrong directory. Should probably be in /Layout, don't you think?

Go to Top