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:
@@ -59,16 +59,14 @@ script(type="text/javascript").
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
videojs.registerPlugin('analytics', function() {
|
videojs(videoPlayer, options).ready(function() {
|
||||||
this.ga({
|
this.ga({
|
||||||
'eventLabel' : '{{ node._id }} - {{ node.name }}',
|
'eventLabel' : '{{ node._id }} - {{ node.name }}',
|
||||||
'eventCategory' : '{{ node.project }}',
|
'eventCategory' : '{{ node.project }}',
|
||||||
'eventsToTrack' : ['start', 'error', 'percentsPlayed']
|
'eventsToTrack' : ['start', 'error', 'percentsPlayed']
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
videojs(videoPlayer, options).ready(function() {
|
|
||||||
this.hotkeys();
|
this.hotkeys();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function addVideoPlayerButton(data) {
|
function addVideoPlayerButton(data) {
|
||||||
|
Reference in New Issue
Block a user