From 06a0c8aecb63f4b90827618cd86a2c529fe53418 Mon Sep 17 00:00:00 2001 From: joe-allen-89 <85872286+joe-allen-89@users.noreply.github.com> Date: Thu, 25 Jan 2024 17:49:31 +0000 Subject: [PATCH 1/2] Fix: events: _.extend to target events function rather than object --- js/simpleVideoBranchingView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/simpleVideoBranchingView.js b/js/simpleVideoBranchingView.js index 043c5ef..be10d64 100644 --- a/js/simpleVideoBranchingView.js +++ b/js/simpleVideoBranchingView.js @@ -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, { From 28143c19245eadeb088b8f104934972c4700cbbd Mon Sep 17 00:00:00 2001 From: joe-allen-89 <85872286+joe-allen-89@users.noreply.github.com> Date: Thu, 25 Jan 2024 18:20:26 +0000 Subject: [PATCH 2/2] Fix: model.set moved to model, empty cc added to avoid error on load --- js/simpleVideoBranchingModel.js | 8 +++++++- js/simpleVideoBranchingView.js | 9 --------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/js/simpleVideoBranchingModel.js b/js/simpleVideoBranchingModel.js index 0b6b0c3..ea543bb 100644 --- a/js/simpleVideoBranchingModel.js +++ b/js/simpleVideoBranchingModel.js @@ -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 }); diff --git a/js/simpleVideoBranchingView.js b/js/simpleVideoBranchingView.js index be10d64..04a5843 100644 --- a/js/simpleVideoBranchingView.js +++ b/js/simpleVideoBranchingView.js @@ -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?.(); },