Skip to content

Commit

Permalink
Fix bug where Question Set children without media fails. HFP-1181
Browse files Browse the repository at this point in the history
  • Loading branch information
tajakobsen committed Jun 7, 2017
1 parent b3887c0 commit 976e956
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions js/questionset.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,16 +411,22 @@ H5P.QuestionSet = function (options, contentId, contentData) {

/**
* 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++) {
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;

This comment has been minimized.

Copy link
@fnoks

fnoks Jul 3, 2017

Contributor

@tajakobsen : If media e.g. is an image, this will fail since playback is undefined... I will fix

if (hasAutoPlay) {
questionInstances[currentQuestion].play();
questionInstances[currentQuestionIndex].play();
}
};

Expand Down

0 comments on commit 976e956

Please sign in to comment.