Skip to content

Commit

Permalink
Merge pull request #12 from apivideo/analytics-v2
Browse files Browse the repository at this point in the history
Fix custom parameters
  • Loading branch information
olivier-lando authored Jul 30, 2024
2 parents 75f865d + 6106366 commit a95f2f9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ test
dist/test
samples/
.github/
index.ts
jest.config.js
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All changes to this project will be documented in this file.

## [2.0.1] - 2024-07-31

- Fix custom parameters

## [2.0.0] - 2024-07-31

- Switch to api.video analytics v2.0
Expand Down
14 changes: 7 additions & 7 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,6 @@ export class VideoJsApiVideoAnalytics extends Plugin {
(this.options as any).mediaUrl = src;
this.setOptions(this.options);
this.lastMediaUrl = src;

const videoElt = this.player.el().querySelector("video");
if (videoElt) {
this.playerAnalytics.ovbserveMedia(videoElt);
} else {
console.error("No video element found in the player");
}
}
} else {
this.passthrough = true;
Expand All @@ -60,6 +53,13 @@ export class VideoJsApiVideoAnalytics extends Plugin {
...options,
});

const videoElt = this.player.el().querySelector("video");
if (videoElt) {
this.playerAnalytics.ovbserveMedia(videoElt);
} else {
console.error("No video element found in the player");
}

this.player.ready(() => {
if (this.isFirstInit) {
events.forEach((eventName) =>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@api.video/videojs-player-analytics",
"version": "2.0.0",
"version": "2.0.1",
"description": "api.video player analytics plugin for videojs",
"repository": {
"type": "git",
Expand Down

0 comments on commit a95f2f9

Please sign in to comment.