Skip to content

Commit

Permalink
fix(FEC-8307): Error event is triggered also when non-critical event …
Browse files Browse the repository at this point in the history
…occurs (#8)

Trigger only critical errors.
  • Loading branch information
Dan Ziv authored Jun 13, 2018
1 parent 295d2d3 commit e6c0e0b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"mocha": "^3.2.0",
"mocha-cli": "^1.0.1",
"playkit-js": "https://github.com/kaltura/playkit-js.git#master",
"playkit-js-providers": "https://github.com/kaltura/playkit-js-providers.git#analytics-service",
"playkit-js-providers": "https://github.com/kaltura/playkit-js-providers.git#master",
"pre-push": "^0.1.1",
"prettier": "^1.13.5",
"sinon": "^2.0.0",
Expand All @@ -83,7 +83,7 @@
},
"peerDependencies": {
"playkit-js": "https://github.com/kaltura/playkit-js.git#master",
"playkit-js-providers": "https://github.com/kaltura/playkit-js-providers.git#analytics-service"
"playkit-js-providers": "https://github.com/kaltura/playkit-js-providers.git#master"
},
"keywords": [],
"license": "AGPL-3.0",
Expand Down
8 changes: 5 additions & 3 deletions src/kava.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ export default class Kava extends BasePlugin {
const rates = this._getRates();
const activeTracks = this.player.getActiveTracks();
this._rateHandler.setRates(rates);
this._rateHandler.setCurrent(activeTracks.video.bandwidth);
if (activeTracks.video) {
this._rateHandler.setCurrent(activeTracks.video.bandwidth);
}
if (activeTracks.audio) {
this._model.updateModel({language: activeTracks.audio.language});
}
Expand Down Expand Up @@ -319,9 +321,9 @@ export default class Kava extends BasePlugin {
}

_onError(event: FakeEvent): void {
this._model.updateModel({errorCode: event.payload.code});
this._sendAnalytics(KavaEventModel.ERROR);
if (event.payload && event.payload.severity === PKError.Severity.CRITICAL) {
this._model.updateModel({errorCode: event.payload.code});
this._sendAnalytics(KavaEventModel.ERROR);
this.reset();
}
}
Expand Down

0 comments on commit e6c0e0b

Please sign in to comment.