Moodle

MP3 filter does not work in uploaded HTML files

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 1.8.2, 1.9
  • Fix Version/s: 1.8.3, 1.9
  • Component/s: Filters
  • Labels:
    None
  • Affected Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE

Description

There is a bug with the new multimedia filter (from Moodle 1.8) with *.mp3 or *.swf files.
When such files are linked from a "composed Web page" within a Moodle course, it works OK.
But when such files are linked from an HTML uploaded file in the course files neither the moodle mp3 player nor the flash player are displayed.
From what I can gather, the "new Javascript system" does correctly write the necessary <object></object> code in the html file before displaying it FOR A COMPOSED WEB PAGE, but it does not write it to the HTML uploaded file.

Example with file audio.mp3:
in composed Web page we get this:
------------------------------------------
Click <a href="http://localhost/moodle18dev/moodle/file.php/2/course/audio.mp3">here</a><span style="visibility: visible;" class="mediaplugin mediaplugin_mp3" id="filter_mp3_11871632651"><object data="http://localhost/moodle18dev/moodle/filter/mediaplugin/mp3player.swf?src=http://localhost/moodle18dev/moodle/file.php/2/course/audio.mp3" type="application/x-shockwave-flash" height="15" width="90"><param value="high" name="quality"><param value="bgColour=000000&amp;btnColour=ffffff&amp;btnBorderColour=cccccc&amp;iconColour=000000&amp;iconOverColour=00cc00&amp;trackColour=cccccc&amp;handleColour=ffffff&amp;loaderColour=ffffff&amp;waitForPlay=yes" name="flashvars"></object></span>
<script type="text/javascript">
//<![CDATA[
var FO = { movie:"http://localhost/moodle18dev/moodle/filter/mediaplugin/mp3player.swf?src=http://localhost/moodle18dev/moodle/file.php/2/course/audio.mp3", width:"90", height:"15", majorversion:"6", build:"40", flashvars:"bgColour=000000&btnColour=ffffff&btnBorderColour=cccccc&iconColour=000000&iconOverColour=00cc00&trackColour=cccccc&handleColour=ffffff&loaderColour=ffffff&waitForPlay=yes", quality: "high" };
UFO.create(FO, "filter_mp3_11871632651");
//]]>
</script> to listen.
------------------------------
in HTML uploaded page we get this:
Click <a href="audio.mp3">here</a><span class="mediaplugin mediaplugin_mp3" id="filter_mp3_11871623921">(MP3 audio)</span>
<script type="text/javascript">
//<![CDATA[
var FO = { movie:"http://localhost/moodle18dev/moodle/filter/mediaplugin/mp3player.swf?src=audio.mp3", width:"90", height:"15", majorversion:"6", build:"40", flashvars:"bgColour=000000&btnColour=ffffff&btnBorderColour=cccccc&iconColour=000000&iconOverColour=00cc00&trackColour=cccccc&handleColour=ffffff&loaderColour=ffffff&waitForPlay=yes", quality: "high" };
UFO.create(FO, "filter_mp3_11871623921");
//]]>
</script> to listen.
----------------------------------------
I have checked in the Admin pages that my filters are ON, and Filter uploaded files is set to HTML files only. I have also checked that there is no path problem.

This is very urgent and important, as our university has upgraded from 1.6 to 1.8, we have a lot of mp3 files linked in our HMTL uploaded files and we do need this pb to be solved for the September new year.
Thanks in advance,
Joseph

Activity

Hide
Martin Dougiamas added a comment -

Yu, can you take a look at this please?

Show
Martin Dougiamas added a comment - Yu, can you take a look at this please?
Hide
Yu Zhang added a comment -

The problem is the ufo.js script needed was not included in a recourse linking to an uploaded file. I added the js file before the call. Cheers, Yu

Show
Yu Zhang added a comment - The problem is the ufo.js script needed was not included in a recourse linking to an uploaded file. I added the js file before the call. Cheers, Yu
Hide
Joseph Rézeau added a comment -

Just tested the fix in 1.8 stable and 1.9 dev.
It works, but unfortunately only for ONE media file per uploaded HTML file (actually, the last one). This is not acceptable, since uploaded HTML file can have any number of media files.
Looking forward to final fix,
Joseph

Show
Joseph Rézeau added a comment - Just tested the fix in 1.8 stable and 1.9 dev. It works, but unfortunately only for ONE media file per uploaded HTML file (actually, the last one). This is not acceptable, since uploaded HTML file can have any number of media files. Looking forward to final fix, Joseph
Hide
Joseph Rézeau added a comment -

Actually, the bug of having only ONE mp3 player displayed is worse than I thought: it happens in ALL Moodle resources (on Moodle1.8 and 1.9):
composed web pages, uploaded HTML pages, questions, etc. can only display ONE mp3 player, attached to the LAST mp3 file linked!!!
This is a serious bug especially for language teachers who use a lot of audio in their courses.
Joseph

Show
Joseph Rézeau added a comment - Actually, the bug of having only ONE mp3 player displayed is worse than I thought: it happens in ALL Moodle resources (on Moodle1.8 and 1.9): composed web pages, uploaded HTML pages, questions, etc. can only display ONE mp3 player, attached to the LAST mp3 file linked!!! This is a serious bug especially for language teachers who use a lot of audio in their courses. Joseph
Hide
Petr Škoda (skodak) added a comment -

I think it worked fine last time I did some changes there, but I am not sure now

Show
Petr Škoda (skodak) added a comment - I think it worked fine last time I did some changes there, but I am not sure now
Hide
Yu Zhang added a comment -

Hi Joseph,

This javascript include is now in the <head> section of your html. This would prevent multiple includes and should fix this problem. Thanks.

Cheers,

Yu

Show
Yu Zhang added a comment - Hi Joseph, This javascript include is now in the <head> section of your html. This would prevent multiple includes and should fix this problem. Thanks. Cheers, Yu
Hide
Andrew Davis added a comment - - edited

I'm not able to get this to work how I think it should.

If I compose a html page within Moodle that includes links to an mp3 file once I activated the multimedia filter I got a embedded player icons. Thats as expected.

I then upload a html page going into a course and clicking on Files in the Administration block. After uploading my page clicking on it pops up my page in a new window but with no player icons. .htm or .html makes no difference.

I then added a resource to a course by clicking on "link to a file or website" in the "add a resource" drop down. Entered the url of my uploaded htm file (http://localhost/moodle_19_stable/file.php/2/mp3test.htm). When I click on the link I still dont get any player icons.

Am I misunderstanding when the filters are applied or are they not being applied when they should be?

Show
Andrew Davis added a comment - - edited I'm not able to get this to work how I think it should. If I compose a html page within Moodle that includes links to an mp3 file once I activated the multimedia filter I got a embedded player icons. Thats as expected. I then upload a html page going into a course and clicking on Files in the Administration block. After uploading my page clicking on it pops up my page in a new window but with no player icons. .htm or .html makes no difference. I then added a resource to a course by clicking on "link to a file or website" in the "add a resource" drop down. Entered the url of my uploaded htm file (http://localhost/moodle_19_stable/file.php/2/mp3test.htm). When I click on the link I still dont get any player icons. Am I misunderstanding when the filters are applied or are they not being applied when they should be?
Hide
Eloy Lafuente (stronk7) added a comment -

Hi Andrew,

if I'm not wrong, by default Moodle doesn't filter uploaded html files. It must be enabled by enabling the "filteruploadedfiles" setting (Admin -> Modules -> Filters -> Manage Filters). Once done the html page is transformed to be able to display those players where needed. Can you re-test that way... and confirm how is it going.... TIA!

Ciao

Show
Eloy Lafuente (stronk7) added a comment - Hi Andrew, if I'm not wrong, by default Moodle doesn't filter uploaded html files. It must be enabled by enabling the "filteruploadedfiles" setting (Admin -> Modules -> Filters -> Manage Filters). Once done the html page is transformed to be able to display those players where needed. Can you re-test that way... and confirm how is it going.... TIA! Ciao
Hide
Petr Škoda (skodak) added a comment -

Please do not reopen such old issues, if there is any regression create a new issue instead and link or clone.

In this particular case the filtering of files needs to be enabled in filter settings, unfortunately this is not 100% reliable because we need to add extra JS into the files and do some other ugly hacking.

In 2.0 the situation should be a bit more flexible because we could enable this feature per activity, in 1.9 is is a global setting, I would personally not recommend it for production because of this.

Show
Petr Škoda (skodak) added a comment - Please do not reopen such old issues, if there is any regression create a new issue instead and link or clone. In this particular case the filtering of files needs to be enabled in filter settings, unfortunately this is not 100% reliable because we need to add extra JS into the files and do some other ugly hacking. In 2.0 the situation should be a bit more flexible because we could enable this feature per activity, in 1.9 is is a global setting, I would personally not recommend it for production because of this.
Hide
Andrew Davis added a comment -

Closing. Works as expected once "Filter uploaded files" is turned on.

Petr, will do.

Show
Andrew Davis added a comment - Closing. Works as expected once "Filter uploaded files" is turned on. Petr, will do.

Dates

  • Created:
    Updated:
    Resolved: