G3 Protected Videos do not play the first time the page is visited and the FIX

rlparadise

Joined: 2009-12-27
Posts: 65
Posted: Thu, 2010-01-07 09:08

Using a recent G3 build from github (couple days old), I noticed an odd error in G3 when visiting any videos that were restricted to registered users. The Flowplayer would initialize but the video would never start. If you navigate away from the page and return or simply hit refresh, the video player would load as would the video and everything was fine.

Here are the steps to reproduce:

1. Upload an mp4 file to G3
2. Restrict access to the mp4 file
3. Login and attempt to watch the mp4

After running with firebug and turning debug on in Flowplayer, I noticed some strange error messages that suggested the clip duration was not loading. After a little debuging, I found that adding the Content-length header before sending the file via the proxy appears to fix this issue.

If someone else has this problem. you can add one extra line to modules/gallery/controllers/file_proxy.php:

   // Dump out the image.  If the item is a movie, then its thumbnail will be a JPG.
    if ($item->is_movie() && $type != "albums") {
      header("Content-type: image/jpeg");
    } else {
      header("Content-Type: $item->mime_type");
    }

    header("Content-Length: " . filesize($file));

    Kohana::close_buffers(false);
    $fd = fopen($file, "rb");
    fpassthru($fd);
    fclose($fd);

When streaming H264 mp4 video files, it makes sense that Flowplayer would want the Content-Length.

Of course, you do not see this problem if you have a public video because you do not go through the file proxy. In that case, Apache serves up the file to Flowplayer.

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16503
Posted: Thu, 2010-01-07 17:02

Please file a bug for this:
https://sourceforge.net/apps/trac/gallery/newticket

Registration on SourceForge is free.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25945
Posted: Fri, 2010-01-08 04:31

rlparadise,
good detective work. Please post the bug url when you create it as well.

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
rlparadise

Joined: 2009-12-27
Posts: 65
Posted: Sun, 2010-01-10 00:14