Skip to content

Commit

Permalink
feat: method to trigger stop manually in the connector
Browse files Browse the repository at this point in the history
  • Loading branch information
slowmove committed Feb 1, 2022
1 parent 79ddfec commit 62cf742
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ playerAnalytics.reportWarning({
});
```

```js
// when leaving the player, to stop the analytics in a correct manor
playerAnalytics.reportStop();
playerAnalytics.destroy();
```

### Manual Event Triggering

```js
Expand Down
9 changes: 9 additions & 0 deletions src/PlayerAnalyticsConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,15 @@ export class PlayerAnalyticsConnector {
});
}

public reportStop() {
this.playerAnalytics.stopped({
event: EPASEvents.ended,
...this.playbackState(),
payload: { reason: "aborted" },
});
this.stopInterval();
}

public reportError(error: TErrorEventPayload) {
this.playerAnalytics.error({
event: EPASEvents.error,
Expand Down

0 comments on commit 62cf742

Please sign in to comment.