Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(FEC-9237): add app protocol for kava plugin #43

Merged
merged 5 commits into from
Jul 21, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/kava.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class Kava extends BasePlugin {
_loadStartTime: number;
_lastDroppedFrames: number = 0;
_lastTotalFrames: number = 0;
_appProtocol: string;

/**
* Default config of the plugin.
Expand Down Expand Up @@ -76,7 +77,7 @@ class Kava extends BasePlugin {
bufferTimeSum: 0.0,
playTimeSum: 0.0
});

this._appProtocol = /^(https?:)/i.test(document.location.protocol) ? document.location.protocol : 'https:';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is becoming a repeating pattern let's add this as a util

getProtocol(defaultProtocol: string): string {
    return /^(https?:)/i.test(document.location.protocol) ? document.location.protocol : defaultProtocol;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have player utils class for such things

// check the Resource Timing API is supported in the browser and we have a uiConfId
if (performance && this.config.uiConfId) {
let entry = performance.getEntriesByType('resource').find(entry => entry.name.match('embedPlaykitJs.*' + this.config.uiConfId));
Expand Down Expand Up @@ -162,7 +163,7 @@ class Kava extends BasePlugin {
*/
sendAnalytics(model: Object): Promise<*> {
return new Promise((resolve, reject) => {
OVPAnalyticsService.trackEvent(this.config.serviceUrl, model)
OVPAnalyticsService.trackEvent(this._appProtocol + this.config.serviceUrl, model)
.doHttpRequest()
.then(
response => {
Expand Down