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

feat(FEC-11785): [Youbora] - update youbora options for drm system that is used by the player #82

Merged
merged 16 commits into from
Jan 24, 2022
1 change: 1 addition & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
node_modules/@playkit-js/playkit-js/flow-typed/
node_modules/kaltura-player-js/flow-typed/
[options]
esproposal.optional_chaining=enable
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Finally, add the bundle as a script tag in your page, and initialize the player
## Configuration

This plugin configuration reflects Youbora options,
For full Youbora options see: https://developer.nicepeopleatwork.com/apidocs/js6/Options.html
For full Youbora options see: https://documentation.npaw.com/npaw-integration/docs/setting-options-and-metadata

## Running the tests

Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"pushTaggedRelease": "git push --follow-tags --no-verify origin master",
"release": "standard-version",
"test": "NODE_ENV=test karma start --color --mode development",
"test:watch": "NODE_ENV=test karma start --browsers=Chrome --single-run=false --auto-watch",
"watch": "webpack --progress --colors --watch --mode development"
},
"lint-staged": {
Expand All @@ -55,7 +56,6 @@
"@babel/preset-env": "^7.10.4",
"@babel/preset-flow": "^7.10.4",
"@babel/register": "^7.10.5",
"@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 @@ -72,7 +72,8 @@
"flow-bin": "^0.129.0",
"husky": "^4.2.5",
"istanbul": "^0.4.5",
"kaltura-player-js": "https://github.com/kaltura/kaltura-player-js.git#v1.0.0",
"kaltura-player-js": "kaltura/kaltura-player-js#master",
"@playkit-js/playkit-js": "canary",
"karma": "^5.1.0",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^3.1.0",
Expand All @@ -99,8 +100,8 @@
"youboralib": "6.7.42"
},
"peerDependencies": {
"@playkit-js/playkit-js": "0.63.0",
"kaltura-player-js": "https://github.com/kaltura/kaltura-player-js.git#v1.0.0"
"kaltura-player-js": "kaltura/kaltura-player-js#master",
"@playkit-js/playkit-js": "canary"
},
"publishConfig": {
"access": "public"
Expand Down
23 changes: 22 additions & 1 deletion src/adapter/adapter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
// @flow
import youbora from 'youboralib';
import {core} from 'kaltura-player-js';
const {Error, MediaType} = core;
const {Error, MediaType, DrmScheme} = core;

const DrmSchemeTitle = {
FAIRPLAY: 'FairPlay',
PLAYREADY: 'PlayReadyCENC',
WIDEVINE: 'WidevineCENC',
UNKNOWN: 'Clear'
};

declare var __VERSION__: string;
declare var __NAME__: string;
Expand Down Expand Up @@ -83,6 +90,19 @@ let YouboraAdapter = youbora.Adapter.extend({
return this.config.householdId;
},

/** @returns {String} - active drm scheme */
getDrmScheme: function (): string {
const activeDrmScheme: ?string = this.player.getDrmInfo()?.scheme;
if (activeDrmScheme) {
for (const [key, value] of Object.entries(DrmScheme)) {
if (value === activeDrmScheme) {
return DrmSchemeTitle[key];
}
}
}
return DrmSchemeTitle.UNKNOWN;
},

/** @returns {void} - Register listeners to this.player. */
registerListeners: function () {
const Event = this.player.Event;
Expand Down Expand Up @@ -158,6 +178,7 @@ let YouboraAdapter = youbora.Adapter.extend({

/** @returns {void} - Listener for 'playing' event. */
playingListener: function () {
this.plugin.options['content.drm'] = this.getDrmScheme();
this.fireResume();
this.fireSeekEnd();
this.fireBufferEnd();
Expand Down
Loading