Skip to content

Commit

Permalink
HFP-1119 Added autoplay option to interactive video.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreascerpus committed Jul 14, 2017
1 parent 0dc04dd commit 9969625
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions semantics.json
Expand Up @@ -634,6 +634,14 @@
"optional": true,
"description": "Enter timecode in the format M:SS"
},
{
"name": "autoplay",
"type": "boolean",
"label": "Auto-play video",
"default": false,
"optional": true,
"description": "Start playing the video automatically"
},
{
"name": "loop",
"type": "boolean",
Expand Down
7 changes: 7 additions & 0 deletions src/scripts/interactive-video.js
Expand Up @@ -152,6 +152,9 @@ function InteractiveVideo(params, id, contentData) {
// determine if video should be looped
loopVideo = params.override && !!params.override.loop;

// determine if video should play automatically
this.autoplay = params.override && !!params.override.autoplay;

// Start up the video player
self.video = H5P.newRunnable({
library: 'H5P.Video 1.3',
Expand Down Expand Up @@ -544,6 +547,10 @@ InteractiveVideo.prototype.attach = function ($container) {


this.currentState = InteractiveVideo.ATTACHED;

if (this.autoplay) {
that.video.play();
}
};

/**
Expand Down

0 comments on commit 9969625

Please sign in to comment.