VideoJS: don't use videojs.registerPlugin() to start Google Analytics

The `registerPlugin()` call should only be done once, and not for every
video shown.

This removes the warning about the 'analytics' plugin already being
registered, which you see when navigating from one video to another via
the JSTree.
This commit is contained in:
2018-08-31 15:52:18 +02:00
parent 05c488c484
commit 3f8e0396cf

View File

@@ -59,16 +59,14 @@ script(type="text/javascript").
}
};
videojs.registerPlugin('analytics', function() {
videojs(videoPlayer, options).ready(function() {
this.ga({
'eventLabel' : '{{ node._id }} - {{ node.name }}',
'eventCategory' : '{{ node.project }}',
'eventsToTrack' : ['start', 'error', 'percentsPlayed']
});
});
videojs(videoPlayer, options).ready(function() {
this.hotkeys();
});
function addVideoPlayerButton(data) {