Skip to content

Commit

Permalink
Fix: Component not loading/working correctly with newer versions of m…
Browse files Browse the repository at this point in the history
…edia component (fixes #2 & #7)
  • Loading branch information
oliverfoster authored Jan 26, 2024
2 parents ca888a9 + 28143c1 commit 8585d6d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
8 changes: 7 additions & 1 deletion js/simpleVideoBranchingModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,14 @@ define([
}
});

// totals are useful to have too
// totals are useful to have too, set initial player state attributes
this.set({
_isMediaEnded: false,
_isMediaPlaying: false,
_media: {
cc: [],
mp4: ' '// prevent console warning 'No media is selected in components.json'
},
_mediaCount: mediaIndex,
_questionCount: questionIndex
});
Expand Down
11 changes: 1 addition & 10 deletions js/simpleVideoBranchingView.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ define([
'click .js-svb-transcript-skip-btn': 'skipToQuestionButtonClicked',
'click .js-svb-results-btn': 'onFinalVideoEnded',
'click .js-retry-btn': 'onRetryClick'
}, Media.view.prototype.events),
}, Media.view.prototype.events()),

preRender: function() {
this.listenTo(Adapt, {
Expand All @@ -29,15 +29,6 @@ define([

_.bindAll(this, 'onMediaElementPlay', 'onMediaElementPause', 'onMediaElementEnded', 'onMediaElementTimeUpdate', 'onMediaElementSeeking');

// set initial player state attributes
this.model.set({
_isMediaEnded: false,
_isMediaPlaying: false,
_media: {
mp4: ' '// prevent console warning 'No media is selected in components.json'
}
});

this.checkIfResetOnRevisit?.();
},

Expand Down

0 comments on commit 8585d6d

Please sign in to comment.