General developer forum

Audio player is visible but audio does not work in student quiz in 3.0

 
Picture of Devdatta Dalvi
Audio player is visible but audio does not work in student quiz in 3.0
 

Dear Moodlers,

I am facing this problem. I used an audio in a quiz for students to listen to and answer questions based on the information in the audio. The audio works well in my admin account but does not play in student's account however the small player can be seen. When students click on the play button, nothing happens; audio does not play.

I am using moodle 3.0. Can anyone help? I would appreciate your help.

 
Average of ratings: -
Picture of Justin Hunt
Re: Audio player is visible but audio does not work in student quiz in 3.0
Group Particularly helpful MoodlersGroup Plugin developers
This usually happens because you pasted the audio link from elsewhere. So the audio file is not actually in the question's file area. If you look at the URL when you are editing the question it should be a draftfiles.php and not a pluginfiles.php link. 


Its simple enough to fix. Just download the audio as admin, remove the current link in the question, upload the new audio file into the question and save. 

 
Average of ratings: -
Picture of Matthias Giger
Re: Audio player is visible but audio does not work in student quiz in 3.0
Group Particularly helpful Moodlers

I have the exactly same problem with Moodle 3.1.7.

When I try to link an audio file or upload it as multimedia in the atto editor, the player shows and the file is supposed to be there (.../draftfile.php/5/user/draft/570592678/sound.mp3), but it doesn't play. Any other idea, why this is happening?

Did I miss any settings?

I've checked the mp3 file and on my computer it plays nicely.

 
Average of ratings: -
Picture of Matthias Giger
Re: Audio player is visible but audio does not work in student quiz in 3.0
Group Particularly helpful Moodlers

Just realised that the problem only occured in the word select question type. So it is probably a problem of the renderer of that question type.

 
Average of ratings: -
Picture of Marcus Green
Re: Audio player is visible but audio does not work in student quiz in 3.0
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developersGroup Testers

Hi Matthias

I have just attempted to reproduce this. I am putting the audio into the main questiontext part not the introduction part. I am using the question directly from the plugins databasein the standard Moodle quiz with Moodle 3.2.2+ (Build: 20170503). It appears to show as expected. It didn't seem to work correctly with Moodle 3.1, though that doesn't make a great deal of sense. Have you tested it with standard quiz as well as  with StudentQuiz? If there is an issue with it working with StudentQuiz I will work to fix it as it is an aweseome tool.

Can you confirm what version of Moodle you are using, and that the issue happens in the body of the question not in the introduction part.  In the next release I will include a sample question with a little audio clip to ensure this is tested. If I can work out how to do it I would like to include a question with an audio clip in the behat testing as this question type lends itself perfectly to using audio.

I have been reading through your previous comments and I wanted to say I really appreciate your feedback. 

 
Average of ratings: -
Picture of Matthias Giger
Re: Audio player is visible but audio does not work in student quiz in 3.0
Group Particularly helpful Moodlers

Dear Marcus

The version I'm using is 3.1.7. And the problem appears only with the Word select question type regardless where you use it (student quiz or normal quiz) - so it is not actually linked to the student quiz.

The code which is generated looks like this:

<audio controls="true"  class="mediaplugin mediaplugin_html5audio" preload="none" title="audio">
<source src="https://mymoodlepath/pluginfile.php/6580/qtype_wordselect/introduction/156/1/10207/sound.mp3" type="audio/mp3"></source>
<audio controls="true"  class="mediaplugin mediaplugin_html5audio" preload="none" title="sound.mp3">
<source src="https://mymoodlepath/pluginfile.php/6580/qtype_wordselect/introduction/156/1/10207/sound.mp3" type="audio/mp3"></source>

<a class="mediafallbacklink" href="https://mymoodlepath/pluginfile.php/6580/qtype_wordselect/introduction/156/1/10207/sound.mp3">sound.mp3</a>
</audio>

In contrast, the code generated when using the gapfill question type looks like this.

<audio controls="true"  class="mediaplugin mediaplugin_html5audio" preload="none" title="audio">
<source src="https://mymoodlepath/pluginfile.php/6580/question/questiontext/155/1/10206/sound.mp3" type="audio/mp3"></source>
<a class="mediafallbacklink" href="https://mymoodlepath/pluginfile.php/6580/question/questiontext/155/1/10206/sound.mp3">sound.mp3</a>
</audio>

It looks as on my installation the wordselect question type is generating repetitive code.


I tried the same with a local Moodle 3.0 installation. The code generated their is slightly different, but the results are the same with the wordselect question type: The player shows, once you press it, is goes gray and no audio is played.

When the pages loads, the player looks the way is should:

Player when page loads

One you click on play, it doesn't work:

Player once play is pressed

I also tried the same in a Moodle 3.3.1 installation (I don't have a 3.2 installation). With slightly different setting Moodle shows an error message: "The media couldn't be loaded ...". The code looks different, but the results are the same. The audio file doesn't play.

In short:

  • The problem only occurs with the word select question type.
  • The problem consists across 3 different installations (Moodle 3.0, 3.1, 3.3 all on different servers, 2 different installations on a web hosting service, one a bitnami local installation).

Hopefully any of these is helpful.

Matthias

 
Average of ratings: -
Picture of Marcus Green
Re: Audio player is visible but audio does not work in student quiz in 3.0
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developersGroup Testers

I have released version 1.1 of the Wordselect question type that addresses this issue. 

https://moodle.org/plugins/qtype_wordselect

Here is the new entry into the releasenotes.md file 


Version 1.1 of the Moodle WordSelect question type by Marcus Green. July 2017

Fixed a bug that prevented audio files working correctly in the question text. Thanks to Matthias Giger for reporting this. Fixed an issue that prevented any files being inserted into the introduction area. Improved phpdoc of the source code.



 
Average of ratings: -