Hi,

I'm trying to put a video field in a panel pane. Is this working ?
I also tried in a views with the

I have a .mov file I want it handled by quicktime.
Instead of the player, there is the video without controls, I can just use the middle mouse button to scroll and "play" the video frame/frame. Where is quicktime player ? What's wrong ?

In panels I use the field formatter : video
In views the format is : video

Thank you for your attention

Comments

Jerome F’s picture

Version: 6.x-4.x-dev » 6.x-3.9
Category: feature » bug
Priority: Normal » Critical
Status: Active » Needs work

Hi, using firebug, I found some errors in the HTML code generated with the video format :

The generated code is :

<div class="field-video-preview-fid">

    <!--[if !IE]> <-->
        <object height="285px" width="350px" data="http://example.com/sites/default/files/video/big-buck-bunny/2010_03_05_330_bigbuckbunny590330.mov" type="video/quicktime">
    <!--> <![endif]-->

        <!--[if IE]>
            <object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
            codebase="http://www.apple.com/qtactivex/qtplugin.cab"
            width="350px" height="285px" scale="tofit" >     
        <![endif]-->
            <param value="http://example.com/sites/default/files/video/big-buck-bunny/2010_03_05_330_bigbuckbunny590330.mov" name="src">
            <param value="1" name="AUTOPLAY">
            <param value="true" name="KIOSKMODE">
            <param value="true" name="CONTROLLER">
                <p>Your browser is not able to display this multimedia content.</p>
        </object>    
</div>

It should be :

<div class="field-video-preview-fid">
         
    <!--[if !IE]> <-->
        <object height="345px" width="590px" data="http://example.com/sites/default/files/video/big-buck-bunny/2010_03_05_330_bigbuckbunny590330.mov" type="video/quicktime">
    <!--> <![endif]-->
    
        <!--[if IE]>
            <object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"      
            codebase="http://www.apple.com/qtactivex/qtplugin.cab"            
            width="590px" height="345px" scale="tofit" >                      
        <![endif]-->
            <param value="http://example.com/sites/default/files/video/big-buck-bunny/2010_03_05_330_bigbuckbunny590330.mov" name="src">
            <param value="true" name="AUTOPLAY">
            <param value="true" name="KIOSKMODE">
            <param value="true" name="CONTROLLER">
                <p>Your browser is not able to display this multimedia content.</p>
        </object>    
</div>


- The height of the both objects should take into account +15px for the player.
- Autoplay need to be "true" not "1"
- My settings for the video player width and height are not taken into account. Where can I save those settings. Is it possible to set one value for each CCK field, as I also have other formats (960x480p, 1280x720p, etc).
I have set : Default Video Player Width : 590 in my CCK field and 16:9 as ratio

I am not a coder and don't know how to make a patch, so any help would be greatly appreciated on this topic.

In the meantime, I plan to use my own html code in views and use the url of the video and rewrite the output of my field.
That is only a workaround and doesn't help with video fields in panels. So I have to use a view pane.

Jerome F’s picture

Component: Miscellaneous » Code
Category: support » bug

Oops

'needs work' means there is a patch to work on.
'critical' is reserved for crash bugs.

Jerome F’s picture

So that is happening in video/includes/common.inc lines 246-289

I can't go further because I don't code in php, and this seems fine to me.

/**
 * Play videos from in Quicktime format
 *
 * @see http://developer.apple.com/internet/ieembedprep.html
 * @param $node
 *   object with node information
 *
 * @return
 *   string of content to display
 */
function theme_video_play_quicktime($element) {
//Increase the height to accommodate the player controls on the bottom.
  $video = file_create_url($element['#item']['filepath']);
  $width = isset($element['#item']['data']['width']) ? $element['#item']['data']['width'] : '';
  $height = isset($element['#item']['data']['height']) ? $element['#item']['data']['height'] : '';
  $width = empty($width) ? '350px' : $width .'px';
  $height = empty($height) ? '285px' : $height .'px';


  // this will be executed by not Internet Explorer browsers
  $output = '<!--[if !IE]> <-->
            <object type="video/quicktime" width="'. $width .'" height="'. $height .'"
            data="'. $video .'">
            <!--> <![endif]-->' . "\n";

  // this will be executed by Internet Explorer
  $output .=  '<!--[if IE]>
              <object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
              codebase="http://www.apple.com/qtactivex/qtplugin.cab"
              width="'. $width .'" height="'. $height .'" scale="tofit" >
              <![endif]-->' . "\n";

  // params will be passed to both IE or not IE browsers
  //GMM: kioskmode enabled so users don't bypass download security video through player
  $output .= '<param name="src" value="'. $video .'" />
              <param name="AUTOPLAY" value="'.(variable_get('video_autoplay', TRUE) ? TRUE : FALSE).'" />
              <param name="KIOSKMODE" value="true" />
              <param name="CONTROLLER" value="true" />' . "\n"
              . //_video_get_parameters($node) .
              '<p>'. t('Your browser is not able to display this multimedia content.') .'</p>
              </object>'; // only one </object> needed becouse only one opening tag has been parsed by browsers

  return $output;
} 
Jerome F’s picture

Trying to rewrite the output of this field in views was a dead end as the html object is not rendered.

I tried the following :

<div class="field-video-preview-fid"> 

    <object id="IEQT" 
            classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
            width="590"
            height="346">
        <param name="src" value="[field_video_preview_fid]"/>
        <param name="autoplay" value="true"/>
        <param name="controller" value="true"/>
    
      <!--%5Bif !IE%5D> <-->
    
        <object id="NonIEQT"
                data="[field_video_preview_fid]"
                type="video/quicktime"
                width="590"
                height="330">
           <param name="autoplay" value="true"/>
           <param name="controller" value="true"/>
        </object>
    
      <!--> <!%5Bendif%5D-->
    
    </object>

</div>

I even tried to use this trick http://drupal.org/node/567918#comment-2756952
[ = %5B
] = %5D

Now I try to use to rewrite the output with my theme using : views-view-field--field-video-preview-fid.tpl.php

Jerome F’s picture

That did the trick I have my workaround :

I just copied this file in both my theme and my admin theme folder and set the field format to the video file url

<?php
// $Id: views-view-field--field-video-preview-fid.tpl.php
// from: views-view-field.tpl.php,v 1.1 2008/05/16 22:22:32 merlinofchaos Exp $
 /**
  * This template is used to print a single field in a view. It is not
  * actually used in default Views, as this is registered as a theme
  * function which has better performance. For single overrides, the
  * template is perfectly okay.
  *
  * Variables available:
  * - $view: The view object
  * - $field: The field handler object that can process the input
  * - $row: The raw SQL result that can be used
  * - $output: The processed output that will normally be used.
  *
  * When fetching output from the $row, this construct should be used:
  * $data = $row->{$field->field_alias}
  *
  * The above will guarantee that you'll always get the correct data,
  * regardless of any changes in the aliasing that might happen if
  * the view is modified.
  */
?> 

<div class="field-video-preview-fid"> 

    <object id="IEQT" 
            classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
            width="590"
            height="330">
        <param name="src" value="<?php print $output; ?>"/>
        <param name="autoplay" value="true"/>
        <param name="controller" value="true"/>
    
      <!--%5Bif !IE%5D> <-->
    
        <object id="NonIEQT"
                data="<?php print $output; ?>"
                type="video/quicktime"
                width="590"
                height="346">
           <param name="autoplay" value="true"/>
           <param name="controller" value="true"/>
        </object>
    
      <!--> <!%5Bendif%5D-->
    
    </object>

</div>

Yet it would be great that the video player works without this workaround.

Jerome F’s picture

Hi,

I created a custom formater to handle the quicktime vidéo in my panels and views.

Here is the related issue in the custom formatter module : http://drupal.org/node/753428

An example of 1280 x 720 px quicktime player :


$output = '';

    if ($element['#item']['filepath'])
    { 
     $output = '
    <div class="field-video-quicktime-720"> 
  
        <object id="IEQT" 
                classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
                width="1280"
                height="736">
            <param name="src" value="http://'.$_SERVER['HTTP_HOST'].'/'.$element['#item']['filepath'].'"/>
            <param name="autoplay" value="true"/>
            <param name="controller" value="true"/>
  
          <!--[if !IE]>-->
  
            <object id="NonIEQT"
                    data="http://'.$_SERVER['HTTP_HOST'].'/'.$element['#item']['filepath'].'"
                    type="video/quicktime"
                    width="1280"
                    height="736">
               <param name="autoplay" value="true"/>
               <param name="controller" value="true"/>
            </object>
  
          <!--<![endif]-->
  
        </object>
  
    </div> ';
    }

return $output;

Hopefully that could help, before the video formatter in video module get fixed.

hypertext200’s picture

Thanks for the great shoot on the panel, quicktime and views

iLLin’s picture

I have reworked the theme engine in 4.x-dev. Each video object has its own template so this should be a lot easier to override going forward. We are still trying to determine the best way to add in the extra height for each video type. If you have ideas let us know.

Jerome F’s picture

@iLLin thank you for your work on this topic,

Either adapt the player size :

I have some problems with videos that are to wide or to high, because the player toolbar is hidden in the object element. Either the widget is able to check the size of the video and adapt the object width and high or the user can enter these values in the widget form. That would be helpfull.
Personnaly I used one formatter for each video standard size and each video type either in views or panels. I had to make the quicktime formatters myself the others provided by the module seems ok.

Or adapt the video size :

On the other hand if all the videos have to be at the same width and high, I can't think of any way but to resize them as imagecache, this means reencode, lose quality, etc. And that sounds like a lot of work !
For the moment I just require every video to be the same size when posted. But I didn't find any way to make that size actually mandatory, as I can still post larger videos that are shamefully cropped by the object element.

iLLin’s picture

Hmmm, well the code tries to determine the resolution from either 4:3 or 16:9. So when its transcoded it resizes based on those dimensions.

Im no video expert, I'm just a code monkey so how do you think this should work? It seems that videos on the web can be any resolution and not just the standard. I wonder if I can extract the video dimensions with ffmpeg. I bet I can, and then from that we can resize "correctly" so there is no cropping.

Send me a message so you can get my email and then send me a video where this does that. I will work on a way to grab the dimensions so when you provide a width, it will resize the height based on the actual dimensions maintaining the proper aspect ratio.

Also give me your best approach on what makes sense to you and we can tune it from there.

Jerome F’s picture

@iLLin : email sent...

when you provide a width, it will resize the height

the standards tend tu use the heights to express video sizes (480p, 720p, 1080p, etc.) I don't understand why we should provide the width, is it because web theming is more about setting up widths ? (that would make sense)

For my use case, I choose to set up three standard sizes, 640 x 360 / 853 x 480 and 1280 x 720 p. These are the same in vimeo, youtube, etc. all in 16:9 If ever I have an other ratio I go for stretching or the black frame.

Even as a themer I prefer to define the player sizes sitewide, as it is visually better than changing the player size on each page (looks chaotic).

The only problem in that case, is that the user has to provide the source files to the actual standard sizes. I know that ffmpeg can handle flash videos and resize them (even if I find the process hard to get working, I didn't maage to configure it yet but that's another topic), but what about wmv, avi, mp4, mov, as for people with smart phones, ipads, etc. ?

This also means I have to provide a formatter for each size / format.

I can easily imagine someone who would like more flexibility, but that's not my case, I'm more concerned about how to handle multiple file sources. Even though the solution for me is that each video is compressed to the right size befor submitting to the site.

Jerome F’s picture

Let's say the dream plan could be to give the user control aver the player size with cck. A possible scenario would be that the user provides a video and fill either one or both form inputs to the size he wants the video to be.
For instance, he provides a video (1280 x 720) twice in a cck video file field and provides the height 480p in the first field and 720p in the second. That user input could also be provided by the site administrator only and both fields could be requested. Then the video would be resized proportionally as scale does in imagecache. But that's really a dream isn't it ? as resizing videos in different formats means to have a compression program on the server not only for flash videos... That's called vimeo, youtube, etc.

And the short end plan would be that the user actually provides a video in the correct final size (853 x 480...) and if ever there is a (640 x 480 or a 800 x 480 (old european format 1.66:1) or 1128 x 480 cinemascope like 2.35:1) the object is cropped or stretched in width accordingly.
(Even better if there is a small error in size like 483 px heigh, the player bar is not hidden nor cropped, because the object height is smart too. But that's not an urgent matter).

An even shorter plan would be that the cck formatter for the quicktime video field is repaired so that we don't need a custom formatter any more.

iLLin’s picture

With FFmpeg we can resize our videos to w/e size we want. Right now you can select a width for the player and then the height is determined by the resolution setup in the admin settings for that field. I wonder, would it be better to have a select dropdown that contains pre-determined standard sizes? Maybe even a way to manage that dropdown so you can add your own options?

That would give the user the complete control of selecting the height and width and you don't need a custom formatter any more as all that would be dynamic.

Also if you have time, check out the 4.x-dev branch. Thats the one I been heavily working on. This version has a stronger theme engine and allows you to assign each extension to its own player. There is also a tpl file for each player so its easily overriden. That tpl file has access to the video object (which contains the width and height), the node object and a $themed_output which is only used for flv files as of now.

iLLin’s picture

I have commited the select dropdown to 4.x-dev. You can grab it from CVS.
http://drupal.org/cvs?commit=366464

Jerome F’s picture

Category: bug » feature

edit : we're running off topic here concerning the bug in 4.x I created a new issue http://drupal.org/node/798844

Jerome F’s picture

Version: 6.x-3.9 » 6.x-4.x-dev

We're discussing 4.X dev so I think it's time to change. The bug report for 3.x is still not fixed though.

Jerome F’s picture

Title: Video field in views and panels 3 quicktime player » Wrong video frame sizes for Video field CCK formatter - quicktime player
Version: 6.x-3.9 » 6.x-3.x-dev
Priority: Critical » Normal
Status: Needs work » Active

Sum up of the original issue :

  • the html element object size
  • extra height for the player bar
  • autoplay=true
  • the sizes defined in the cck field are not taken into account
  • If this is a won't fis because further development is transferred to 4.x dev feel free to change the status accordingly, but I'm not comfortable with messing up issues.

    iLLin’s picture

    Status: Active » Closed (won't fix)

    Yea all my efforts are going into 4.x-dev. It has changed so much since 3.x that its better to focus on 4.x bugs than fix 3.x bugs as it will be obsolete soon. 4.x-dev has so many more features and the new way we are handling themeing should fix these issues for you.