Media in Quiz questions

Re: Media in Quiz questions

by Joseph Rézeau -
Number of replies: 2
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
This is a reply to a private message from Daniel asking for more info about inserting a link to an MP3 file within a quiz question.
There are various ways to insert links to media files in Moodle.
You can
(1) insert a link which when clicked will open a new window activating your computer's default media player (e.g. quicktime, realaudio, windows media player, etc.)
(2) OR rely on the automatic insertion of the small Flash player built-in Moodle
(3) OR both!

Result (1) will be achieved if the Flash player has not been activated by admin.
Indeed, for the small Flash player to appear, it must have been activated by the administrator of your Moodle site. Logged in as admin, go to Administration » Configuration » Filters, and move the Multimedia plugins option from the Inactive (right) to the Active (left) column.
Sample coding in text of a quiz question (you need the HTM editor to be activated, of course).
(3) method to display both a link and the Flash media player
  1. In the question text, type "Listen to this sound and say what you heard."
  2. Select this sound
  3. Click on the Insert Web Link button
  4. Give the address of your MP3 file, either a web address or an internal address of a file located in the moodledata directory of your Moodle course.
  5. Toggle HTML source and view the result, something like this:
    Listen to < a href="http://moodle/file.php/2/audio/trumpet.mp3" >this sound< /a > and say what you heard.
  6. Now type in the rest of your question data, depending on its type (MCQ, short answer, etc.).
  7. The result will look something like (3) in screen dump below.
  8. The student has a choice of using the Flash player (with its minimum buttons) or clicking on the link, which will open the computer's default media player, with all its buttons.
(2) Method to get the Flash player only, and no link to open an external player
  1. In the question text, type "Listen to this sound xxx and say what you heard."
  2. Select xxx
  3. Click on the Insert Web Link button
  4. Give the address of your MP3 file, either a web address or an internal address of a file located in the moodledata directory of your Moodle course.
  5. Toggle HTML source and view the result, something like this:
    Listen to < a href="http://moodle/file.php/2/audio/trumpet.mp3" >xxx< /a > and say what you heard.
  6. Delete xxx
  7. The result will look something like (2) in screen dump below.
  8. The student can only use the Flash player.
NOTE that it is also possible to embed an external media player in the HTML code of a question, but this requires that admin has enabled this embed facility, which is not recommended for safety reasons. Also, embedding works differently in different browsers; the result depends on the student's actual default media player on his computer (and its version) and the final result can be quite unpredictable. This is why the Moodle Flash media player, although limited in its capacities, is my preferred solution.
Hope this helps.smile
Joseph
Attachment Image1.jpg
Average of ratings: Useful (2)
In reply to Joseph Rézeau

Re: Media in Quiz questions

by Carlos Maciel -
I'm having problems with this solution.

All that appears in IE8 for instance, is a blank rectangle where the flash object should appear (the legend movie not loaded appears in the right-click menu).

In Firefox it doesn't show at all (but the flash object is in the source code).

I checked the source code where the flash object was and I found something like this:

In reply to Carlos Maciel

Re: Media in Quiz questions

by Carlos Maciel -
Nevermind. The issue was that the flash player was looking for the file like this:

http://mysite/filter/mediaplugin/mp3player.swf?src=http://mysite/files.php/5/folder/file.mp3

and for some reason this works:

http://mysite/filter/mediaplugin/mp3player.swf?src=../../files.php/5/folder/file.mp3

So apparently I cannot use absolute paths as a parameter for the mp3player.swf file. In my server at least.