Combination Gallery 2/AVI/Firefox does not display video

edwardotis

Joined: 2004-07-26
Posts: 38
Posted: Thu, 2007-09-27 19:55

Try this Firefox extension out. Worked like a charm for me, and keeps things embedded in the page.

Media Wrap
https://addons.mozilla.org/en-US/firefox/addon/1879

or If you want the media to open outside the browser window in Media Player, you can use this one.

MediaPlayerConnectivity
https://addons.mozilla.org/en-US/firefox/addon/446

enjoy,

Ed

 
jonziring

Joined: 2004-01-29
Posts: 1
Posted: Mon, 2007-11-26 20:44

So, essentially I combined jvincent and sholden's suggestions because I wanted a download link and the embeded video. The lines were different than jvincent's GalleryMovieItem.class file so I figured I'd share my diff as well. Hope this help someone.

-Jon

GalleryMovieItem.class
234c234
< switch ($this->getMimeType()) {
---
> switch ($mimeType = $this->getMimeType()) {
260a261,263
> if( $mimeType == 'video/x-msvideo' ); {
> $mimeType = 'video/x-ms-wmv';
> }
262a266
> echo sprintf('<p>%s</p>',$fallback);
286c290
< $this->getMimeType(),
---
> $mimeType,

 
KEYofR
KEYofR's picture

Joined: 2007-11-27
Posts: 1
Posted: Tue, 2007-11-27 18:57
jvincent wrote:
Here is my workaround (5 lines change).

.../modules/core/classes/GalleryMovieItem.class

diff:
248c248
< switch($this->getMimeType()) {
---
> switch($mimeType = $this->getMimeType()) {
274a275,277
> if( $mimeType == 'video/x-msvideo' ); {
> $mimeType = 'video/x-ms-wmv';
> }
294c297
< $this->getMimeType(),
---
> $mimeType,

This didn't work for me, perhaps because the line numbers were slightly different in my file (Gallery 2.1.1) and you didn't include any context, (grr) so I had no idea where to put the 274-277 section though I could figure out the other two. I was putting it right after the switch, before the case. Trying to load an album that had any videos in it would just give a blank browser window.

But this slghtly different way worked. Put the re-write outside of and before the entire switch statement.

$mimeType = $this->getMimeType();
    if( $mimeType == 'video/x-msvideo' ) {
        $mimeType = 'video/x-ms-wmv';
    }
switch($mimeType) {
...
$mimeType,
...

Also, You are one thousand percent right about how to treat this, as something that needs a work-around within Gallery, at least unless a similar workaround might appear in firefox or possibly the divx web-player installer or of course if the real problem in the MS mplayer plugin ever gets fixed by MS.

I can fix up my own browser any number of ways, or just use IE, but I'm still left with a web site that I have to always tell people what they can and can't do in order for the site to work "oh by the way it only works in internet explorer..." It doesn't matter that Gallery isn't what's broken, it's still no good to have a site that requires instructions.

It's not even that it's so galling to say it works in IE but not in firefox. If it worked everywhere _but_ IE, it would be even worse.
The problem is it's unacceptable to have to say anything at all.

As far as this kind of fix breaking other contexts, I think we have all the info we need in order to make the fix very specific.

First, the file command on one of the .avi's that my camera generates, does include "divx" (actually "XviD" in my case)

$ file SNV31104.AVI
SNV31104.AVI: RIFF (little-endian) data, AVI, 640 x 480, 30.00 fps, video: XviD, audio: ADPCM (mono, 22050 Hz)

so if necessary we can limit the fix to only divx, or a list of known broken codecs, not all .avi. However I think the problem isn't divx or divx+.avi, but any file that gets that mime-type. firefox doesn't know what to do with the mime-type, so detecting divx and only fixing divx probably isn't desireable. But it's there.

Actually, where is that mime-type coming from anyways? What decided that the mime type should be "video/x-msvideo" in the first place? Maybe the fix should go there?

Second, Don't we know what browser the client is using? Or at least what it's claiming to be? So we can also limit the re-write to only happen for firefox. In fact, can't we limit it to happen only for Windows firefox?

 
rmmcclay

Joined: 2002-11-21
Posts: 4
Posted: Fri, 2007-12-07 07:37

I had this same problem of AVI videos not playing in Firefox with Gallery G2. It would display a box prompting to download a plugin. It would check, but then report Unknown Plugin. Nice Firefox! =)

I found this solution which worked for me...but of course it's not much of a solution for visitors:

*********************************

It turns out, to fix this problem, you need to associate video/x-msvideo in Firefox. Instructions provided by: Avi in firefox.

To do this, open the following file in notepad:
%APPDATA%\Mozilla\Firefox\pluginreg.dat

Search for “Windows Media Player Plug-in Dynamic Link Library” and add the bolded lines:

Windows Media Player Plug-in Dynamic Link Library|$
10
0|application/asx|Media Files|*|$
1|video/x-ms-asf-plugin|Media Files|*|$
2|application/x-mplayer2|Media Files|*|$
3|video/x-ms-asf|Media Files|asf,asx,*|$
4|video/x-ms-wm|Media Files|wm,*|$
5|audio/x-ms-wma|Media Files|wma,*|$
6|audio/x-ms-wax|Media Files|wax,*|$
7|video/x-ms-wmv|Media Files|wmv,*|$
8|video/x-ms-wvx|Media Files|wvx,*|$
9|video/x-msvideo|Media Files|avi,*|$

Increasing 9 to 10 tells it that there’s 9 mime types you should associate this plug-in with. Adding the video/x-msvideo line tells it to associate mime types of that with Windows Media Player. Afterwards, all my avi files began to play fine.

After saving this file, restart Firefox and video with the mime type of x-msvideo should play fine.
Share and Enjoy:
--
http://www.krunk4ever.com/blog/2007/05/14/missing-codecs-in-firefox-to-play-video-in-gallery2/

 
Antonimo

Joined: 2007-08-07
Posts: 3
Posted: Sun, 2007-12-16 22:17

Could somebody post the full, working "GalleryMovieItem.class" - My file seems to be different.

I am using Gallery 2.2.2 and lines 258 - 266 look like this:

	    case 'video/mpeg':
	    case 'video/mp4':
	    case 'video/x-msvideo':
	    case 'video/x-ms-wmv':
		$classId = 'CLSID:05589FA1-C356-11CE-BF01-00AA0055595A';
	    case 'video/x-ms-asf':
	    case 'video/x-ms-asx':
		if (!isset($classId)) {
		    $classId = 'CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95';

I would prefer to go the route that does not require any extra effort from the website's visitors.

 
buccinator

Joined: 2007-12-29
Posts: 1
Posted: Sat, 2007-12-29 01:36

replace (inside render func)

case($this->getMimeType()) with $mimeType = getMimeTyps(); case($mimeType)
and any remaining $this->getMimeType() inside the render function with $mimeType

then replace case 'video/x-msvideo': with case 'video/x-msvideo': $mimeType = 'video/x-ms-wmv';

see how you go, im using bleeding edge everything but the snippet you posted looks similar enough

Antonimo wrote:
Could somebody post the full, working "GalleryMovieItem.class" - My file seems to be different.

I am using Gallery 2.2.2 and lines 258 - 266 look like this:

	    case 'video/mpeg':
	    case 'video/mp4':
	    case 'video/x-msvideo':
	    case 'video/x-ms-wmv':
		$classId = 'CLSID:05589FA1-C356-11CE-BF01-00AA0055595A';
	    case 'video/x-ms-asf':
	    case 'video/x-ms-asx':
		if (!isset($classId)) {
		    $classId = 'CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95';

I would prefer to go the route that does not require any extra effort from the website's visitors.

 
tallthom

Joined: 2008-02-04
Posts: 6
Posted: Thu, 2008-02-14 01:27

Still seeing this problem in Firefox with avi files from a digital camera (MJPEG format, I think). (Mom just wants to see the kiddies!)

Did we end up with a final resolution to this problem? Is the G2 supported position that I edit my Firefox settings for the proper mime type? Or should I implement the "hack" to the GalleryMovieItem.class file listed above (in various forms, shapes, and sizes)? Or has this thread moved and I've been the only one not to find it's new location?

Please advise.

PS - I always get frustrated (as do others) when the open source community can't decide whose problem is whose. As mentioned by other frustrated folks, if it doesn't work for the end user... they are more likely to go back to the non-open source solutions.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2008-02-14 04:16
Quote:
Did we end up with a final resolution to this problem?

Not that I am aware of. Too many variables from source files to browsers/OSs/players.

Quote:
PS - I always get frustrated (as do others) when the open source community can't decide whose problem is whose. As mentioned by other frustrated folks, if it doesn't work for the end user... they are more likely to go back to the non-open source solutions.

I think the best solution is to convert videos to .fla files. We have a great player that works on more platforms/browsers.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
rogermh

Joined: 2005-01-09
Posts: 102
Posted: Thu, 2008-02-14 06:27
Quote:
I think the best solution is to convert videos to .fla files. We have a great player that works on more platforms/browsers.

Or convert them to Quicktime (.mov) files. The .avi (MJPEG) files from my Canon camera are monstrously large. Quicktime reduces the file size considerably while maintaining video quality. And, of course, the converted .mov files work on both IE and FF. :-)

 
TheAnt

Joined: 2006-05-24
Posts: 24
Posted: Sat, 2008-02-16 12:31
sholden wrote:
On my local install I modified modules/core/classes/GalleryMovieItems.class to put the "Download Movie" link outside the object block. In other words I changed '<noembed>%s</noembed></object>' to '</object><p>%s</p>' (around line 286).

That way the download link always shows up, so IE users can easily download the video, and firefox users can click the link to view it.

I have got some problem with the download link...
I have tried do get the download link to work but it does not work properly. In IE it works good, i get the embed player and the download link gets the file to download. In mozilla i had the download link working, but when i added the support for X-msvideo in mozilla, http://www.krunk4ever.com/blog/2007/05/14/missing-codecs-in-firefox-to-play-video-in-gallery2/ the download link just takes me to a new blank page.
Anyone have a clue how to change either gallery to get me to the file or change mozilla to get the file properly. Since it works in IE i recon the problem is in firefox, but who knows.

 
deechte

Joined: 2008-02-24
Posts: 8
Posted: Thu, 2008-02-28 16:25
Quote:
GalleryMovieItem.class
234c234
< switch ($this->getMimeType()) {
---
> switch ($mimeType = $this->getMimeType()) {
260a261,263
> if( $mimeType == 'video/x-msvideo' ); {
> $mimeType = 'video/x-ms-wmv';
> }
262a266
> echo sprintf('<p>%s</p>',$fallback);
286c290
< $this->getMimeType(),
---
> $mimeType,

Thanks a lot! This works for me with Gallery 2.2.4. Now movies play fine embedded with both IE and Firefox. I too wanted a solution on my server. Didn't want my visitors to have to change things...

 
douglasvb

Joined: 2008-09-15
Posts: 12
Posted: Wed, 2008-09-17 00:38

Did a fix end up making it into Gallery 2.3RC1?

 
Takster

Joined: 2008-09-25
Posts: 1
Posted: Thu, 2008-09-25 04:34
mindless wrote:
here's one workaround: use quicktime plugin instead of media player.

Pretty lame suggestion, you think I wanna post instructions on editing firefox files or avoiding .avi because the GALLERY cant handle it? you have the workarounds here for the script that are never implemented. Lucky this is free beer because if I had a developer palming me off with stupid suggestions my mother would think of rather then FIX the code IN THE GALLERY I'd be looking for new dev's. Just fix the damn thing, it's been long enough already. You cant blame MS or firefox when other gallery scripts have no problems playing an avi.

 
TheAnt

Joined: 2006-05-24
Posts: 24
Posted: Fri, 2008-09-26 11:24
Quote:
Here is my workaround (5 lines change)....

It took me a while to get it working, didnt really understand the code change since the lines had changes from the version you had
here is what i changed.
On line 234

list ($width, $height) = array($this->getWidth(), $this->getHeight());
switch($this->getMimeType()) {
case 'video/quicktime':

to

         
list ($width, $height) = array($this->getWidth(), $this->getHeight());
switch($mimeType = $this->getMimeType()) {
case 'video/quicktime':

and on line 259

case 'video/mpeg':
case 'video/mp4':
case 'video/x-msvideo':
case 'video/x-ms-wmv':

to

case 'video/mpeg':
case 'video/mp4':
case 'video/x-msvideo':
if( $mimeType == 'video/x-msvideo' ); {
  $mimeType = 'video/x-ms-wmv';
}
case 'video/x-ms-wmv':

and last on line 287

$src, $src,
$width, $height + 50,
$this->getMimeType(),
$fallback);

to

$src, $src,
$width, $height + 50,
$mimeType,
$fallback);
 
deechte

Joined: 2008-02-24
Posts: 8
Posted: Tue, 2008-11-18 13:33
deechte wrote:
Quote:
GalleryMovieItem.class
234c234
< switch ($this->getMimeType()) {
---
> switch ($mimeType = $this->getMimeType()) {
260a261,263
> if( $mimeType == 'video/x-msvideo' ); {
> $mimeType = 'video/x-ms-wmv';
> }
262a266
> echo sprintf('<p>%s</p>',$fallback);
286c290
< $this->getMimeType(),
---
> $mimeType,

Thanks a lot! This works for me with Gallery 2.2.4. Now movies play fine embedded with both IE and Firefox. I too wanted a solution on my server. Didn't want my visitors to have to change things...

Well, I recently updated to G2.3, and the problem wasn't fixed with the new release. However, the workaround above still works. The GalleryMovieItem.class file from G2.2.4 can even be used in G2.3. The contents are the same, except for some comments. The code is identical. Good thing is that the fix also puts the direct download link back!