Note: You are currently viewing documentation for Moodle 2.3. Up-to-date documentation for the latest stable version is available here: MP3 player.

MP3 player: Difference between revisions

From MoodleDocs
(rewording and removing out-of-date info - please re-add any info if deleted by mistake)
 
(42 intermediate revisions by 15 users not shown)
Line 1: Line 1:
The multimedia filter embeds MP3 files in a streaming player made with Flash. The big MP3 player is used when an MP3 file is added as a [[Resources|resource]] e.g. [http://moodle.org/mod/resource/view.php?id=2296 Moodle Features Demo: MP3 file]. The small player is used when an MP3 file is linked to from within a forum post or another resource or activity using the [[HTML editor]].
{{Working with media}}
The multimedia filter embeds MP3 files in a streaming player made with Flash. A larger MP3 player is used when an MP3 file is added as a [[File module settings|file]] or [[URL module settings|URL resource]] and a smaller MP3 player is used when an MP3 file is linked to from within a forum post or any other text area using the Moodle media button in the [[Text editor|text editor]] or by typing the URL of the MP3 file.


==MP3 player rates==
==MP3 player customisation==


To ensure that MP3 files are played at the correct rate, sample rates of 11, 22 or 44 kHz should be used. Constant Bit Rate (CBR) files are also recommended over Variable Bit Rate (VBR) files.
It is possible to customise the colours of the the MP3 player via CSS included in the theme. For example


==Flash security settings==
<code>
.mp3flowplayer_backgroundColor {color: #000000;}
</code>


Security changes in Flash player 7 may result in the MP3 player not playing MP3 files hosted on a remote server. This issue may be resolved by writing a cross-domain policy for the remote server and/or each user changing their global security settings in the Flash player settings manager.
modifies the background colour, see http://flowplayer.org/documentation/skinning/controlbar.html?skin=default for more colour properties, any property that ends with '...Color' can be overridden via CSS.


===Cross-domain policy===
For accessibility reasons it is not allowed to initiate an automatic playback.


To create a cross-domain policy, save the code below as ''crossdomain.xml'' and place the file at the root of the remote server.
==Tips and tricks==


<cross-domain-policy>
===Inserting sounds into questions===
    <allow-access-from domain="www.yourmoodlesite.org" />
</cross-domain-policy>


Please refer to [http://www.macromedia.com/devnet/flash/articles/fplayer_security.html Macromedia - Developer Center: Security Changes in Macromedia Flash Player 7] for further details.
[[Image:Quiz question MP3 example.JPG|thumb||Quiz question with sound]]
 
Method to get the Flash player only, and no link to open an external player:
===Global security settings===
 
Please refer to [http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager02.html Macromedia - Flash Player Help: Global Privacy Settings Panel].
 
==MP3 player colours==
 
''theme/yourtheme/config.php'' contains options for changing the default colours (black, white and grey) of the MP3 player.
 
$THEME->resource_mp3player_colors =
  'bgColour=000000&btnColour=ffffff&btnBorderColour=cccccc&iconColour=000000&'.
  'iconOverColour=00cc00&trackColour=cccccc&handleColour=ffffff&loaderColour=ffffff&'.
  'font=Arial&fontColour=3333FF';
/// With this you can control the colours of the "big" MP3 player
/// that is used for MP3 resources.
 
$THEME->filter_mediaplugin_colors =
  'bgColour=000000&btnColour=ffffff&btnBorderColour=cccccc&iconColour=000000&'.
  'iconOverColour=00cc00&trackColour=cccccc&handleColour=ffffff&loaderColour=ffffff&';
/// ...And this controls the small embedded player
 
==MP3 playback options==
 
''theme/yourtheme/config.php'' contains options for changing the playback options of the MP3 player.
 
* <code>waitForPlay</code> determines whether the MP3 file starts downloading as soon as the player appears on the page (<code>waitForPlay=no</code>), or whether the play button must be pressed before the MP3 file starts downloading (<code>waitForPlay=yes</code>).
 
* <code>autoPlay</code> determines whether the MP3 player starts playing the MP3 as soon as the player appears on the page (<code>autoPlay=yes</code>), or whether it must be fully downloaded before playing (<code>autoPlay=no</code>).
 
* <code>buffer</code> determines how many seconds of the MP3 file must be downloaded before the MP3 starts playing e.g. 10 seconds (<code>buffer=10</code>).
 
'''Default playback options'''
 
* Big MP3 player: <code>buffer=10&waitForPlay=no&autoPlay=yes</code>
* Small MP3 player: <code>waitForPlay=yes&autoPlay=no</code>
 
==Inserting sounds into questions==
[http://moodle.org/mod/forum/discuss.php?d=33335 In a forum, Joseph Rézeau] offer this
 
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!
 
The [[filter]] for multimedia must be on and Flash enabled. The HTML editor needs to be active for the question content.
#In the question text, type "Listen to this sound and select your answer."
#Select by highlighting "this sound"
#Click on the Insert Web Link button
#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.
#Toggle HTML source and view the result, something like this: Listen to <nowiki> < a href="http://moodle/file.php/2/audio/trumpet.mp3" >this sound< /a > </nowiki>and say what you heard.
#Now type in the rest of your question data, depending on its type (MCQ, short answer, etc.).
#The result will look something like (3) in screen dump below.
#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


#In the question text, type "Listen to this sound xxx and say what you heard."
#In the question text, type "Listen to this sound xxx and say what you heard."
#Select xxx
#Select xxx
#Click on the Insert Web Link button
#Click on the Insert Web Link button
#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.
#Give the address of your MP3 file
#Toggle HTML source and view the result, something like this: Listen to <nowiki>< a href="http://moodle/file.php/2/audio/trumpet.mp3" >xxx< /a > </nowiki> and say what you heard.
#Toggle HTML source and view the result, something like this: Listen to <nowiki>< a href="http://moodle/file.php/2/audio/trumpet.mp3" >xxx< /a > </nowiki> and say what you heard.
#Delete xxx
#Delete xxx
#The result will look something like (2) in screen dump below.
#The student can only use the Flash player.


[[Image:Quiz question MP3 example.JPG|thumb|center|Example of Quiz Question with Sound]]
The student can then only use the Flash player.


==Questions (If you know the answer, please add it here.) ==
===Temporarily disable the MP3 player ===
* Is there anyway to temporarily disable the automatic addition of the Flash player when including links to MP3 files?  Within the course, I'd like the flash player to be normally used, but occasionally when linking to external MP3 files, the file names are not compatible with the Flash player. For example, http://www.eigopod2.com/classic/シンデレラ.mp3
* You can surround your link with <nowiki><nolink></nolink></nowiki> tags to stop any kind of processing including the multimedia filters that create the MP3 player. This may be useful when linking to external MP3 files with characters in their name that Flash cannot understand.
:''TIP:''  Be careful with the no link tags or any user written HTML code.  The [[Text editor]] may eliminate some of your work if you use the editor in the future.  The text editor tries to tidy things up for the new user but this can frustrate an experienced user of HTML code.
:''NOTE:'' This does not work for something like the following inserted into a page resource.
<nowiki><nolink><a href="http://theExampleServer.com/file.php/55/mp3_2/mt16/The_file.mp3"> The_file.mp3</a></nolink></nowiki> , however you can stop the multimedia filter from showing when linking to files by adding ?forcedownload=1 to the end of the link.


==See also==
==See also==
* [[Audio in Moodle]] for  links to audio MP3 encoders, audio programs, modules and plugins for Moodle
*[http://moodle.org/mod/forum/discuss.php?d=199218#p869558  Useful forum post regarding mp3s] (with thanks to Guillermo Madero S


* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=43297 Multimedia resource filtering on the course page] forum discussion
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=14663 mp3 player rates] forum discussion
* [[Podcasting]]
[[Category:Administrator]]
[[Category:Teacher]]
[[Category:Filter]]
[[Category:Filter]]
[[Category:Audio]]
[[Category:Audio]]
[[ja:MP3プレイヤー]]

Latest revision as of 16:49, 18 July 2012

The multimedia filter embeds MP3 files in a streaming player made with Flash. A larger MP3 player is used when an MP3 file is added as a file or URL resource and a smaller MP3 player is used when an MP3 file is linked to from within a forum post or any other text area using the Moodle media button in the text editor or by typing the URL of the MP3 file.

MP3 player customisation

It is possible to customise the colours of the the MP3 player via CSS included in the theme. For example

.mp3flowplayer_backgroundColor {color: #000000;}

modifies the background colour, see http://flowplayer.org/documentation/skinning/controlbar.html?skin=default for more colour properties, any property that ends with '...Color' can be overridden via CSS.

For accessibility reasons it is not allowed to initiate an automatic playback.

Tips and tricks

Inserting sounds into questions

Quiz question with sound

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
  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

The student can then only use the Flash player.

Temporarily disable the MP3 player

  • You can surround your link with <nolink></nolink> tags to stop any kind of processing including the multimedia filters that create the MP3 player. This may be useful when linking to external MP3 files with characters in their name that Flash cannot understand.
TIP: Be careful with the no link tags or any user written HTML code. The Text editor may eliminate some of your work if you use the editor in the future. The text editor tries to tidy things up for the new user but this can frustrate an experienced user of HTML code.
NOTE: This does not work for something like the following inserted into a page resource.

<nolink><a href="http://theExampleServer.com/file.php/55/mp3_2/mt16/The_file.mp3"> The_file.mp3</a></nolink> , however you can stop the multimedia filter from showing when linking to files by adding ?forcedownload=1 to the end of the link.

See also