Moodle

windows media video *.wmv does not open in FireFox

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Won't Fix
  • Affects Version/s: 1.6, 1.6.1, 1.6.2, 1.6.3, 1.6.4, 1.6.5, 1.6.6, 1.6.7, 1.7, 1.7.1, 1.7.2, 1.7.3, 1.7.4, 1.7.5, 1.8, 1.8.1, 1.8.2, 1.8.3, 1.8.4, 1.8.5, 1.8.6, 1.9, 1.9.1, 1.9.2, 1.9.3, 1.9.4, 1.9.5, 1.9.6
  • Fix Version/s: None
  • Component/s: Files API
  • Labels:
    None
  • Environment:
    All versions of Firefox, Safari Mac
  • Affected Branches:
    MOODLE_16_STABLE, MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE

Description

Firefox's WMV plugin can not load .wmv files via moodle's file.php.

I've discovered an ugly but working solution to this problem. As you stated in MDL-6140, the problem has to do with cookies. Once the Media Player plug in loads in Firefox the moodle file.php can't find the cookies it's looking for to verify it's session.

If you pass the PHPSESSID and the session_test key in the url, you can reset the cookies from file.php and everything will load just fine. I know this isn't the most secure or elegant solution but it solves the problem. A better solution might be to generate a temporary key that can be passed in the URL to verify the session once, then be discarded.

Here are my code changes.

In /mod/resource/type/file/resource.class.php

Around line 310 I've changed: $relativeurl = "/file.php/{$course->id}/{$resource->reference}";
TO: $relativeurl = "/file.php/PHPSESSID/".session_id()."/sstest/".$_SESSION['SESSION']>session_test."/{$course>id}/{$resource->reference}";

Around line 316 I've changed: $relativeurl = "/file.php?file=/{$course->id}/{$resource->reference}";
TO: $relativeurl = "/file.php?PHPSESSID=".session_id()."&sstest=".$_SESSION['SESSION']>session_test."&file=/{$course>id}/{$resource->reference}";

In /file.php I've added the following lines of code around line 40:

if($args[0] == 'PHPSESSID'){
setcookie('MoodleSession', $args[1]);
$pathname = str_replace("/PHPSESSID/".$args[1], "", $pathname);
$args = array_splice($args, 2);
}

if($args[0] == 'sstest'){
setcookie('MoodleSessionTest', $args[1]);
$pathname = str_replace("/sstest/".$args[1], "", $pathname);
$args = array_splice($args, 2);
}

Like I said, this isn't the best solution, but it is a solution... and if it leads to a better solution that's great!

Issue Links

Activity

Hide
Andrew Winter added a comment -

Same issue I believe

Show
Andrew Winter added a comment - Same issue I believe
Hide
Wen Hao Chuang added a comment -

Just curious, is this an issue in FireFox 3.0.x WMV plugin, FireFox 2.x.x WMV plugin, or both?

Show
Wen Hao Chuang added a comment - Just curious, is this an issue in FireFox 3.0.x WMV plugin, FireFox 2.x.x WMV plugin, or both?
Hide
Andrew Winter added a comment -

I believe I was having the problem with both, I'd need to setup a test environment and check to be sure.

Show
Andrew Winter added a comment - I believe I was having the problem with both, I'd need to setup a test environment and check to be sure.
Hide
Donna Hrynkiw added a comment -

The bug still exists in v1.9.4+

And the code in the distribution version of resource.class.php has changed sufficiently that Andrew's "ugly but working" (his description in MDL-6140) solution can no longer be applied.

The need is still there however. We have teachers creating WMV content that cannot be viewed in Firefox via Moodle.

The content displays fine in Firefox outside of Moodle, and in IE via Moodle. Telling our students to use a particular browser when they want to view a WMV file in their Moodle course is not an option.

Donna Hrynkiw
Kwantlen Polytechnic

Show
Donna Hrynkiw added a comment - The bug still exists in v1.9.4+ And the code in the distribution version of resource.class.php has changed sufficiently that Andrew's "ugly but working" (his description in MDL-6140) solution can no longer be applied. The need is still there however. We have teachers creating WMV content that cannot be viewed in Firefox via Moodle. The content displays fine in Firefox outside of Moodle, and in IE via Moodle. Telling our students to use a particular browser when they want to view a WMV file in their Moodle course is not an option. Donna Hrynkiw Kwantlen Polytechnic
Hide
graham ramsey added a comment -

I have this problem. I took a simpler approach than Andrew, and decided to make all the uploaded media publicly accessible by commenting out a single line in file.php that requires the user to log in. This fixes the problem.

} else if ($course->id != SITEID) { // require_login($course->id); Obviously this wont suit everyone from a security point of view, but it does for me (and works with current code). The change in patch format is given below :- --- file.php 2009-03-16 22:23:51.000000000 +0000 +++ file.php 2009-03-16 22:49:57.000000000 +0000 @@ -62,7 +62,7 @@ require_login(); }
} else if ($course->id != SITEID) { - require_login($course->id); +// require_login($course->id); } else if ($CFG->forcelogin) {
if (!empty($CFG->sitepolicy)
and ($CFG->sitepolicy == $CFG->wwwroot.'/file.php'.$relativepath

Show
graham ramsey added a comment - I have this problem. I took a simpler approach than Andrew, and decided to make all the uploaded media publicly accessible by commenting out a single line in file.php that requires the user to log in. This fixes the problem. } else if ($course->id != SITEID) { // require_login($course->id); Obviously this wont suit everyone from a security point of view, but it does for me (and works with current code). The change in patch format is given below :- --- file.php 2009-03-16 22:23:51.000000000 +0000 +++ file.php 2009-03-16 22:49:57.000000000 +0000 @@ -62,7 +62,7 @@ require_login(); } } else if ($course->id != SITEID) { - require_login($course->id); +// require_login($course->id); } else if ($CFG->forcelogin) { if (!empty($CFG->sitepolicy) and ($CFG->sitepolicy == $CFG->wwwroot.'/file.php'.$relativepath
Hide
Eric Merrill added a comment -

Updating the affected version, and added a fix version, so it will show up in the standard searches of tickets that need closing.

Also, this affects Safari on Mac the same way.

Show
Eric Merrill added a comment - Updating the affected version, and added a fix version, so it will show up in the standard searches of tickets that need closing. Also, this affects Safari on Mac the same way.
Hide
Eric Merrill added a comment -

Here is a patch file that runs off the current (1.9.5+ 20090930) file.php

This is not something to be committed to moodle - it opens a (albeit minor) security hole. But this is of interest to people with the problem.

This basically skips security checks for files that have a WMV extension.

-Eric

Show
Eric Merrill added a comment - Here is a patch file that runs off the current (1.9.5+ 20090930) file.php This is not something to be committed to moodle - it opens a (albeit minor) security hole. But this is of interest to people with the problem. This basically skips security checks for files that have a WMV extension. -Eric
Hide
Petr Škoda (skodak) added a comment -

hmm, I do not think we can remove login requirement like this in all installations by default

Workaround is easy, do not upload wmv into moodle - store them somewhere else. In 2.0 it will be possible to create a custom repository plugin that would be able to link such external videos, or you can convert the videos to some more accessible format

Show
Petr Škoda (skodak) added a comment - hmm, I do not think we can remove login requirement like this in all installations by default Workaround is easy, do not upload wmv into moodle - store them somewhere else. In 2.0 it will be possible to create a custom repository plugin that would be able to link such external videos, or you can convert the videos to some more accessible format
Hide
Ralf Krause added a comment -

WMV files embedded in Moodle do not play also in Safari, Firefox, Camino, and Opera in Mac OS X 10.5 and 10.6.
I installed the newest Flip4Mac but I got no positive result. The problem does not change if the film is stored inside of Moodle or if the film comes from an external server without any restrictions.

Show
Ralf Krause added a comment - WMV files embedded in Moodle do not play also in Safari, Firefox, Camino, and Opera in Mac OS X 10.5 and 10.6. I installed the newest Flip4Mac but I got no positive result. The problem does not change if the film is stored inside of Moodle or if the film comes from an external server without any restrictions.
Hide
Petr Škoda (skodak) added a comment -

I am sorry, wmv videos are not suitable for web because the necessary browser plugins do not integrate properly.
Hopefully HTL5 is going to solve this in the future, for now use flash based videos instead.

Thank you for the report.

Petr Skoda

Show
Petr Škoda (skodak) added a comment - I am sorry, wmv videos are not suitable for web because the necessary browser plugins do not integrate properly. Hopefully HTL5 is going to solve this in the future, for now use flash based videos instead. Thank you for the report. Petr Skoda

Dates

  • Created:
    Updated:
    Resolved: