Fix bug where Question Set children without media fails. HFP-1181

revert-11-add-override-of-check-button
Tom Arild Jakobsen 2017-06-07 14:44:42 +02:00
parent b3887c0f56
commit 976e9567c6
1 changed files with 9 additions and 3 deletions

View File

@ -411,16 +411,22 @@ H5P.QuestionSet = function (options, contentId, contentData) {
/** /**
* Handle autoplays, limit to one at a time * Handle autoplays, limit to one at a time
*
* @param {number} currentQuestionIndex
*/ */
var handleAutoPlay = function (currentQuestion) { var handleAutoPlay = function (currentQuestionIndex) {
for (var i = 0; i < questionInstances.length; i++) { for (var i = 0; i < questionInstances.length; i++) {
questionInstances[i].pause(); questionInstances[i].pause();
} }
var hasAutoPlay = params.questions[currentQuestion].params.media.params.playback.autoplay; var currentQuestion = params.questions[currentQuestionIndex];
var hasAutoPlay = currentQuestion
&& currentQuestion.params.media
&& currentQuestion.params.media.params.playback.autoplay;
if (hasAutoPlay) { if (hasAutoPlay) {
questionInstances[currentQuestion].play(); questionInstances[currentQuestionIndex].play();
} }
}; };