Skip to content

Commit

Permalink
feat(FEC-10057): move the plugin manager to kaltura player (#44)
Browse files Browse the repository at this point in the history
import the plugin infra and types from kaltura-player
Depends on kaltura/kaltura-player-js#332
  • Loading branch information
yairans authored Aug 5, 2020
1 parent c975bbb commit f14eb91
Show file tree
Hide file tree
Showing 9 changed files with 395 additions and 133 deletions.
1 change: 1 addition & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
[libs]
node_modules/@playkit-js/playkit-js/flow-typed/
node_modules/playkit-js-providers/flow-typed/
node_modules/kaltura-player-js/flow-typed/
[options]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @flow
declare module '@playkit-js/playkit-js' {
declare module 'kaltura-player-js' {
declare module.exports: any;
}
14 changes: 10 additions & 4 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@ const customLaunchers = {
}
};

const launchers = {
Chrome_browser: {
base: 'Chrome',
flags: ['--no-sandbox', '--autoplay-policy=no-user-gesture-required']
}
};

module.exports = function (config) {
let karmaConf = {
logLevel: config.LOG_INFO,
browserDisconnectTimeout: 50000,
browserNoActivityTimeout: 70000,
browsers: ['Chrome', 'Firefox'],
customLaunchers: launchers,
browsers: ['Chrome_browser', 'Firefox'],
concurrency: 1,
singleRun: true,
colors: true,
Expand All @@ -37,7 +43,7 @@ module.exports = function (config) {
client: {
mocha: {
reporter: 'html',
timeout: 70000
timeout: 5000
}
}
};
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"@babel/preset-env": "^7.10.4",
"@babel/preset-flow": "^7.10.4",
"@babel/register": "^7.10.5",
"@playkit-js/playkit-js": "0.62.1-canary.724715e",
"@playkit-js/playkit-js": "0.63.0",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.1.0",
"babel-plugin-istanbul": "^6.0.0",
Expand All @@ -74,6 +74,7 @@
"flow-bin": "^0.129.0",
"husky": "^4.2.5",
"istanbul": "^0.4.5",
"kaltura-player-js": "https://github.com/kaltura/kaltura-player-js.git#v0.56.0",
"karma": "^5.1.0",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^3.1.0",
Expand All @@ -89,7 +90,7 @@
"lint-staged": "^10.2.11",
"mocha": "^8.0.1",
"mocha-cli": "^1.0.1",
"playkit-js-providers": "https://github.com/kaltura/playkit-js-providers.git#update-dist",
"playkit-js-providers": "https://github.com/kaltura/playkit-js-providers.git#v2.22.0",
"prettier": "^2.0.5",
"sinon": "^9.0.2",
"sinon-chai": "^3.5.0",
Expand All @@ -100,8 +101,9 @@
"webpack-dev-server": "^3.11.0"
},
"peerDependencies": {
"@playkit-js/playkit-js": "0.62.1-canary.724715e",
"playkit-js-providers": "https://github.com/kaltura/playkit-js-providers.git#update-dist"
"@playkit-js/playkit-js": "0.63.0",
"kaltura-player-js": "https://github.com/kaltura/kaltura-player-js.git#v0.56.0",
"playkit-js-providers": "https://github.com/kaltura/playkit-js-providers.git#v2.22.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import {registerPlugin} from '@playkit-js/playkit-js';
import {registerPlugin} from 'kaltura-player-js';
import KAnalytics from './kanalytics';

declare var __VERSION__: string;
Expand Down
6 changes: 3 additions & 3 deletions src/kanalytics.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@flow
import {BasePlugin} from '@playkit-js/playkit-js';
import {BasePlugin} from 'kaltura-player-js';
import {OVPStatsService, RequestBuilder} from 'playkit-js-providers/dist/playkit-stats-service';
import EventTypes from './event-types';
import Event from './event';
Expand Down Expand Up @@ -163,7 +163,7 @@ export default class KAnalytics extends BasePlugin {
*/
_sendSeekAnalytic(): void {
const now = new Date().getTime();
if (this._lastSeekEvent + SEEK_OFFSET < now && (this.player.config.type !== LIVE || this.player.config.dvr)) {
if (this._lastSeekEvent + SEEK_OFFSET < now && (this.player.config.sources.type !== LIVE || this.player.config.sources.dvr)) {
// avoid sending lots of seeking while scrubbing
this._sendAnalytics(EventTypes.SEEK);
this._hasSeeked = true;
Expand All @@ -177,7 +177,7 @@ export default class KAnalytics extends BasePlugin {
* @return {void}
*/
_sendTimePercentAnalytic(): void {
if (this.player.config.type !== LIVE) {
if (this.player.config.sources.type !== LIVE) {
const percent = this.player.currentTime / this.player.duration;
if (!this._timePercentEvent.PLAY_REACHED_25 && percent >= 0.25) {
this._timePercentEvent.PLAY_REACHED_25 = true;
Expand Down
Loading

0 comments on commit f14eb91

Please sign in to comment.