Refactor xAPI Video verb creation to get correct id URI

pull/43/head
Paul Ryan 2018-02-06 15:31:47 -10:00
parent 8ecba8a2e7
commit d71ed1afdc
1 changed files with 20 additions and 6 deletions

View File

@ -77,6 +77,14 @@ H5P.XAPIEvent.prototype.setVerb = function (verb) {
} }
}; };
} }
else if (H5P.jQuery.inArray(verb, H5P.XAPIEvent.allowedXAPIVideoVerbs) !== -1) {
this.data.statement.verb = {
'id': 'https://w3id.org/xapi/video/verbs/' + verb,
'display': {
'en-US': verb
}
};
}
else if (verb.id !== undefined) { else if (verb.id !== undefined) {
this.data.statement.verb = verb; this.data.statement.verb = verb;
} }
@ -310,14 +318,20 @@ H5P.XAPIEvent.allowedXAPIVerbs = [
'terminated', 'terminated',
'voided', 'voided',
// Custom verbs for video events
'played',
'paused',
'seeked',
'finished',
// Custom verbs used for action toolbar below content // Custom verbs used for action toolbar below content
'downloaded', 'downloaded',
'accessed-embed', 'accessed-embed',
'accessed-copyright' 'accessed-copyright'
]; ];
/**
* List of video verbs defined at {@link https://w3id.org/xapi/video/|xAPI Video Profile}
*
* @type Array
*/
H5P.XAPIEvent.allowedXAPIVideoVerbs = [
'played',
'paused',
'seeked',
'finished',
];