@playkit-js/playkit-js-providers 2.39.1 → 2.39.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/playkit-analytics-service.js +2 -0
- package/dist/playkit-analytics-service.js.map +1 -0
- package/dist/playkit-bookmark-service.js +2 -0
- package/dist/playkit-bookmark-service.js.map +1 -0
- package/dist/playkit-ott-provider.js +2 -0
- package/dist/playkit-ott-provider.js.map +1 -0
- package/dist/playkit-ovp-provider.js +2 -0
- package/dist/playkit-ovp-provider.js.map +1 -0
- package/dist/playkit-stats-service.js +2 -0
- package/dist/playkit-stats-service.js.map +1 -0
- package/package.json +1 -1
- package/.babelrc +0 -22
- package/.editorconfig +0 -10
- package/.eslintignore +0 -3
- package/.eslintrc.json +0 -26
- package/.flowconfig +0 -5
- package/.github/ISSUE_TEMPLATE.md +0 -28
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -12
- package/.github/workflows/run_canary_full_flow.yaml +0 -28
- package/.github/workflows/run_prod.yaml +0 -24
- package/.github/workflows/run_tests.yaml +0 -24
- package/.prettierignore +0 -7
- package/.prettierrc +0 -12
- package/docs/configuration.md +0 -225
- package/karma.conf.js +0 -42
- package/src/entities/bumper.js +0 -23
- package/src/entities/drm.js +0 -46
- package/src/entities/entry-list.js +0 -15
- package/src/entities/image-source.js +0 -37
- package/src/entities/media-entry.js +0 -96
- package/src/entities/media-format.js +0 -46
- package/src/entities/media-source.js +0 -70
- package/src/entities/media-sources.js +0 -79
- package/src/entities/playlist.js +0 -37
- package/src/index.html +0 -11
- package/src/k-provider/common/base-provider-parser.js +0 -0
- package/src/k-provider/common/base-provider.js +0 -110
- package/src/k-provider/common/base-service-result.js +0 -57
- package/src/k-provider/common/data-loader-manager.js +0 -115
- package/src/k-provider/common/multi-request-builder.js +0 -112
- package/src/k-provider/common/response-types/kaltura-access-control-message.js +0 -22
- package/src/k-provider/common/response-types/kaltura-drm-playback-plugin-data.js +0 -39
- package/src/k-provider/ott/config.js +0 -22
- package/src/k-provider/ott/index.js +0 -15
- package/src/k-provider/ott/loaders/asset-list-loader.js +0 -68
- package/src/k-provider/ott/loaders/asset-loader.js +0 -69
- package/src/k-provider/ott/loaders/data-loader-manager.js +0 -15
- package/src/k-provider/ott/loaders/session-loader.js +0 -62
- package/src/k-provider/ott/provider-parser.js +0 -282
- package/src/k-provider/ott/provider.js +0 -242
- package/src/k-provider/ott/response-types/kaltura-asset.js +0 -79
- package/src/k-provider/ott/response-types/kaltura-bumper-playback-plugin-data.js +0 -28
- package/src/k-provider/ott/response-types/kaltura-playback-context.js +0 -74
- package/src/k-provider/ott/response-types/kaltura-playback-source.js +0 -63
- package/src/k-provider/ott/response-types/kaltura-rule-action.js +0 -26
- package/src/k-provider/ott/services/asset-service.js +0 -50
- package/src/k-provider/ott/services/bookmark/bookmark-service.js +0 -49
- package/src/k-provider/ott/services/bookmark/index.js +0 -12
- package/src/k-provider/ott/services/ott-service.js +0 -34
- package/src/k-provider/ott/services/user-service.js +0 -32
- package/src/k-provider/ovp/config.js +0 -28
- package/src/k-provider/ovp/external-captions-builder.js +0 -38
- package/src/k-provider/ovp/index.js +0 -13
- package/src/k-provider/ovp/loaders/data-loader-manager.js +0 -17
- package/src/k-provider/ovp/loaders/entry-list-loader.js +0 -69
- package/src/k-provider/ovp/loaders/media-entry-loader.js +0 -84
- package/src/k-provider/ovp/loaders/playlist-loader.js +0 -66
- package/src/k-provider/ovp/loaders/session-loader.js +0 -62
- package/src/k-provider/ovp/loaders/ui-config-loader.js +0 -71
- package/src/k-provider/ovp/play-source-url-builder.js +0 -60
- package/src/k-provider/ovp/provider-parser.js +0 -451
- package/src/k-provider/ovp/provider.js +0 -344
- package/src/k-provider/ovp/regex-action-handler.js +0 -147
- package/src/k-provider/ovp/request-params/base-entry-response-profile.js +0 -29
- package/src/k-provider/ovp/response-types/index.js +0 -18
- package/src/k-provider/ovp/response-types/kaltura-access-control-modify-request-host-regex-action.js +0 -36
- package/src/k-provider/ovp/response-types/kaltura-base-entry-list-response.js +0 -31
- package/src/k-provider/ovp/response-types/kaltura-bumper.js +0 -26
- package/src/k-provider/ovp/response-types/kaltura-flavor-asset.js +0 -109
- package/src/k-provider/ovp/response-types/kaltura-media-entries.js +0 -23
- package/src/k-provider/ovp/response-types/kaltura-media-entry.js +0 -141
- package/src/k-provider/ovp/response-types/kaltura-metadata-list-response.js +0 -23
- package/src/k-provider/ovp/response-types/kaltura-metadata.js +0 -51
- package/src/k-provider/ovp/response-types/kaltura-playback-context.js +0 -96
- package/src/k-provider/ovp/response-types/kaltura-playback-source.js +0 -90
- package/src/k-provider/ovp/response-types/kaltura-playlist.js +0 -35
- package/src/k-provider/ovp/response-types/kaltura-rule-action.js +0 -28
- package/src/k-provider/ovp/response-types/kaltura-ui-conf-response.js +0 -90
- package/src/k-provider/ovp/services/analytics/analytics-service.js +0 -57
- package/src/k-provider/ovp/services/analytics/index.js +0 -12
- package/src/k-provider/ovp/services/base-entry-service.js +0 -76
- package/src/k-provider/ovp/services/meta-data-service.js +0 -30
- package/src/k-provider/ovp/services/ovp-service.js +0 -33
- package/src/k-provider/ovp/services/playlist-service.js +0 -63
- package/src/k-provider/ovp/services/session-service.js +0 -28
- package/src/k-provider/ovp/services/stats/index.js +0 -12
- package/src/k-provider/ovp/services/stats/stats-service.js +0 -33
- package/src/k-provider/ovp/services/ui-conf-service.js +0 -33
- package/src/util/clone.js +0 -23
- package/src/util/error/category.js +0 -12
- package/src/util/error/code.js +0 -79
- package/src/util/error/error.js +0 -48
- package/src/util/error/severity.js +0 -23
- package/src/util/logger.js +0 -108
- package/src/util/param.js +0 -45
- package/src/util/request-builder.js +0 -187
- package/src/util/xml-parser.js +0 -40
- package/test/.eslintrc.json +0 -9
- package/test/setup/karma.js +0 -5
- package/test/setup/load-specs.js +0 -13
- package/test/setup/prepare-test-environment.js +0 -17
- package/test/src/k-provider/ott/be-data.js +0 -3306
- package/test/src/k-provider/ott/media-config-data.js +0 -793
- package/test/src/k-provider/ott/provider-parser.spec.js +0 -30
- package/test/src/k-provider/ott/provider.spec.js +0 -384
- package/test/src/k-provider/ott/services/bookmark-service.spec.js +0 -38
- package/test/src/k-provider/ovp/be-data.js +0 -3932
- package/test/src/k-provider/ovp/external-captions-builder.spec.js +0 -59
- package/test/src/k-provider/ovp/media-config-data.js +0 -1509
- package/test/src/k-provider/ovp/playback-sources-data.js +0 -229
- package/test/src/k-provider/ovp/provider-parser-data.js +0 -142
- package/test/src/k-provider/ovp/provider-parser.spec.js +0 -96
- package/test/src/k-provider/ovp/provider.spec.js +0 -1075
- package/test/src/k-provider/ovp/regex-action-handler-data.js +0 -794
- package/test/src/k-provider/ovp/regex-action-handler.spec.js +0 -93
- package/test/src/k-provider/ovp/services/analytics-service.spec.js +0 -62
- package/test/src/k-provider/ovp/services/stats-service.spec.js +0 -37
- package/test/src/util/param.spec.js +0 -23
- package/webpack.config.js +0 -85
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
//@flow
|
|
2
|
-
import ServiceResult from '../../common/base-service-result';
|
|
3
|
-
import {KalturaAccessControlMessage} from '../../common/response-types/kaltura-access-control-message';
|
|
4
|
-
import KalturaRuleAction from './kaltura-rule-action';
|
|
5
|
-
import KalturaPlaybackSource from './kaltura-playback-source';
|
|
6
|
-
import KalturaBumpersPlaybackPluginData from './kaltura-bumper-playback-plugin-data';
|
|
7
|
-
|
|
8
|
-
export default class KalturaPlaybackContext extends ServiceResult {
|
|
9
|
-
static Type: {[type: string]: string} = {
|
|
10
|
-
DOWNLOAD: 'DOWNLOAD',
|
|
11
|
-
TRAILER: 'TRAILER',
|
|
12
|
-
CATCHUP: 'CATCHUP',
|
|
13
|
-
START_OVER: 'START_OVER',
|
|
14
|
-
PLAYBACK: 'PLAYBACK'
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* @member - The playback sources
|
|
18
|
-
* @type {Array<KalturaPlaybackSource>}
|
|
19
|
-
*/
|
|
20
|
-
sources: Array<KalturaPlaybackSource> = [];
|
|
21
|
-
/**
|
|
22
|
-
* @member - Array of actions as received from the rules that invalidated
|
|
23
|
-
* @type {Array<KalturaRuleAction>}
|
|
24
|
-
*/
|
|
25
|
-
actions: Array<KalturaRuleAction> = [];
|
|
26
|
-
/**
|
|
27
|
-
* @member - Array of access control massages
|
|
28
|
-
* @type {Array<KalturaAccessControlMessage>}
|
|
29
|
-
*/
|
|
30
|
-
messages: Array<KalturaAccessControlMessage> = [];
|
|
31
|
-
/**
|
|
32
|
-
* @member - Array of bumper plugins
|
|
33
|
-
* @type {Array<KalturaBumpersPlaybackPluginData>}
|
|
34
|
-
*/
|
|
35
|
-
plugins: Array<KalturaBumpersPlaybackPluginData> = [];
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @constructor
|
|
39
|
-
* @param {Object} response The response
|
|
40
|
-
*/
|
|
41
|
-
constructor(response: Object) {
|
|
42
|
-
super(response);
|
|
43
|
-
if (!this.hasError) {
|
|
44
|
-
const messages = response.messages;
|
|
45
|
-
if (messages) {
|
|
46
|
-
messages.map(message => this.messages.push(new KalturaAccessControlMessage(message)));
|
|
47
|
-
}
|
|
48
|
-
const actions = response.actions;
|
|
49
|
-
if (actions) {
|
|
50
|
-
actions.map(action => this.actions.push(new KalturaRuleAction(action)));
|
|
51
|
-
}
|
|
52
|
-
const sources = response.sources;
|
|
53
|
-
if (sources) {
|
|
54
|
-
sources.map(source => this.sources.push(new KalturaPlaybackSource(source)));
|
|
55
|
-
}
|
|
56
|
-
const plugins = response.plugins;
|
|
57
|
-
if (plugins) {
|
|
58
|
-
plugins.map(plugin => this.plugins.push(new KalturaBumpersPlaybackPluginData(plugin)));
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
hasBlockAction(): boolean {
|
|
64
|
-
return this.getBlockAction() !== undefined;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
getBlockAction(): ?KalturaRuleAction {
|
|
68
|
-
return this.actions.find(action => action.type === KalturaRuleAction.Type.BLOCK);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
getErrorMessages(): Array<KalturaAccessControlMessage> {
|
|
72
|
-
return this.messages;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
//@flow
|
|
2
|
-
import {KalturaDrmPlaybackPluginData} from '../../common/response-types/kaltura-drm-playback-plugin-data';
|
|
3
|
-
|
|
4
|
-
export type OTTKalturaPlaybackSource = KalturaPlaybackSource;
|
|
5
|
-
|
|
6
|
-
export default class KalturaPlaybackSource {
|
|
7
|
-
format: string;
|
|
8
|
-
protocols: string;
|
|
9
|
-
drm: Array<KalturaDrmPlaybackPluginData> = [];
|
|
10
|
-
adsPolicy: string;
|
|
11
|
-
adsParam: string;
|
|
12
|
-
duration: number;
|
|
13
|
-
url: string;
|
|
14
|
-
type: string;
|
|
15
|
-
fileId: number;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @constructor
|
|
19
|
-
* @param {Object} source The response
|
|
20
|
-
*/
|
|
21
|
-
constructor(source: Object) {
|
|
22
|
-
this.format = source.format;
|
|
23
|
-
this.adsPolicy = source.adsPolicy;
|
|
24
|
-
this.adsParam = source.adsParam;
|
|
25
|
-
this.duration = source.duration;
|
|
26
|
-
this.url = source.url;
|
|
27
|
-
this.type = source.type;
|
|
28
|
-
this.fileId = source.id;
|
|
29
|
-
this.protocols = source.protocols;
|
|
30
|
-
if (source.drm) {
|
|
31
|
-
source.drm.map(drm => this.drm.push(new KalturaDrmPlaybackPluginData(drm)));
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Checks if source has DRM data
|
|
37
|
-
* @function hasDrmData
|
|
38
|
-
* @returns {boolean} Is source has DRM
|
|
39
|
-
*/
|
|
40
|
-
hasDrmData(): boolean {
|
|
41
|
-
return this.drm && this.drm.length > 0;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Returns source desired protocol if supported
|
|
46
|
-
* @param {string} protocol - the desired protocol for the source (base play url protocol)
|
|
47
|
-
* @returns {string} - protocol if protocol is in the protocols list - if not empty string returned
|
|
48
|
-
*/
|
|
49
|
-
getProtocol(protocol: string): string {
|
|
50
|
-
let returnValue: string = '';
|
|
51
|
-
if (this.protocols && this.protocols.length > 0) {
|
|
52
|
-
let protocolsArr: Array<string> = this.protocols.split(',');
|
|
53
|
-
protocolsArr.forEach(p => {
|
|
54
|
-
if (p === protocol) {
|
|
55
|
-
returnValue = p;
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
} else if (protocol === 'http') {
|
|
59
|
-
return protocol;
|
|
60
|
-
}
|
|
61
|
-
return returnValue;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
//@flow
|
|
2
|
-
export default class KalturaRuleAction {
|
|
3
|
-
static Type: {[type: string]: string | number} = {
|
|
4
|
-
BLOCK: 'BLOCK',
|
|
5
|
-
START_DATE_OFFSET: 'START_DATE_OFFSET',
|
|
6
|
-
END_DATE_OFFSET: 'END_DATE_OFFSET',
|
|
7
|
-
USER_BLOCK: 'USER_BLOCK',
|
|
8
|
-
ALLOW_PLAYBACK: 'ALLOW_PLAYBACK',
|
|
9
|
-
BLOCK_PLAYBACK: 'BLOCK_PLAYBACK',
|
|
10
|
-
APPLY_DISCOUNT_MODULE: 'APPLY_DISCOUNT_MODULE'
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @member - The type of the action
|
|
15
|
-
* @type {string|number}
|
|
16
|
-
*/
|
|
17
|
-
type: string | number;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @constructor
|
|
21
|
-
* @param {Object} data - The response
|
|
22
|
-
*/
|
|
23
|
-
constructor(data: Object) {
|
|
24
|
-
this.type = data.type;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
//@flow
|
|
2
|
-
import OTTService from './ott-service';
|
|
3
|
-
import RequestBuilder from '../../../util/request-builder';
|
|
4
|
-
|
|
5
|
-
const SERVICE_NAME: string = 'asset';
|
|
6
|
-
|
|
7
|
-
export default class OTTAssetService extends OTTService {
|
|
8
|
-
/**
|
|
9
|
-
* Creates an instance of RequestBuilder for session.startWidgetSession
|
|
10
|
-
* @function anonymousSession
|
|
11
|
-
* @param {string} serviceUrl The service base URL
|
|
12
|
-
* @param {string} ks The partner ID
|
|
13
|
-
* @param {string} assetId The asset ID
|
|
14
|
-
* @param {string} type The asset type (media/recording/epg)
|
|
15
|
-
* @param {ProviderPlaybackContextOptions} playbackContextOptions The playbackContextOptions
|
|
16
|
-
* @returns {RequestBuilder} The request builder
|
|
17
|
-
* @static
|
|
18
|
-
*/
|
|
19
|
-
static getPlaybackContext(
|
|
20
|
-
serviceUrl: string,
|
|
21
|
-
ks: string,
|
|
22
|
-
assetId: string,
|
|
23
|
-
type: string,
|
|
24
|
-
playbackContextOptions: ProviderPlaybackContextOptions
|
|
25
|
-
): RequestBuilder {
|
|
26
|
-
const headers: Map<string, string> = new Map();
|
|
27
|
-
headers.set('Content-Type', 'application/json');
|
|
28
|
-
const request = new RequestBuilder(headers);
|
|
29
|
-
request.service = SERVICE_NAME;
|
|
30
|
-
request.action = 'getPlaybackContext';
|
|
31
|
-
request.method = 'POST';
|
|
32
|
-
request.url = request.getUrl(serviceUrl);
|
|
33
|
-
const contextDataParams: Object = {objectType: 'KalturaPlaybackContextOptions'};
|
|
34
|
-
Object.assign(contextDataParams, playbackContextOptions);
|
|
35
|
-
request.params = {assetId: assetId, assetType: type, contextDataParams: contextDataParams, ks: ks};
|
|
36
|
-
return request;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
static get(serviceUrl: string, ks: string, assetId: string, assetReferenceType: string): RequestBuilder {
|
|
40
|
-
const headers: Map<string, string> = new Map();
|
|
41
|
-
headers.set('Content-Type', 'application/json');
|
|
42
|
-
const request = new RequestBuilder(headers);
|
|
43
|
-
request.service = SERVICE_NAME;
|
|
44
|
-
request.action = 'get';
|
|
45
|
-
request.method = 'POST';
|
|
46
|
-
request.url = request.getUrl(serviceUrl);
|
|
47
|
-
request.params = {id: assetId, assetReferenceType: assetReferenceType, ks: ks};
|
|
48
|
-
return request;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
//@flow
|
|
2
|
-
import OTTService from '../ott-service';
|
|
3
|
-
import RequestBuilder from '../../../../util/request-builder';
|
|
4
|
-
import OTTConfiguration from '../../config';
|
|
5
|
-
|
|
6
|
-
const SERVICE_NAME: string = 'bookmark';
|
|
7
|
-
|
|
8
|
-
export default class OTTBookmarkService extends OTTService {
|
|
9
|
-
/**
|
|
10
|
-
* Creates an instance of RequestBuilder for session.startWidgetSession
|
|
11
|
-
* @function add
|
|
12
|
-
* @param {string} serviceUrl - The service url
|
|
13
|
-
* @param {string} ks - The ks
|
|
14
|
-
* @param {Object} bookmark - The udid
|
|
15
|
-
* @returns {RequestBuilder} - The request builder
|
|
16
|
-
* @static
|
|
17
|
-
*/
|
|
18
|
-
static add(serviceUrl: string, ks: string, bookmark: Object): RequestBuilder {
|
|
19
|
-
const headers: Map<string, string> = new Map();
|
|
20
|
-
headers.set('Content-Type', 'application/json');
|
|
21
|
-
const request = new RequestBuilder(headers);
|
|
22
|
-
request.service = SERVICE_NAME;
|
|
23
|
-
request.action = 'add';
|
|
24
|
-
request.method = 'POST';
|
|
25
|
-
request.url = request.getUrl(serviceUrl);
|
|
26
|
-
const playerData: Object = {
|
|
27
|
-
objectType: 'KalturaBookmarkPlayerData',
|
|
28
|
-
action: bookmark.playerData.action,
|
|
29
|
-
averageBitrate: bookmark.playerData.averageBitrate,
|
|
30
|
-
totalBitrate: bookmark.playerData.totalBitrate,
|
|
31
|
-
currentBitrate: bookmark.playerData.currentBitrate,
|
|
32
|
-
fileId: bookmark.playerData.fileId
|
|
33
|
-
};
|
|
34
|
-
const bookmarkServiceParams: Object = {
|
|
35
|
-
objectType: 'KalturaBookmark',
|
|
36
|
-
type: bookmark.type,
|
|
37
|
-
context: bookmark.context,
|
|
38
|
-
id: bookmark.id,
|
|
39
|
-
position: bookmark.position,
|
|
40
|
-
playerData: playerData
|
|
41
|
-
};
|
|
42
|
-
if (bookmark.programId) bookmarkServiceParams.programId = bookmark.programId;
|
|
43
|
-
const config = OTTConfiguration.get();
|
|
44
|
-
const serviceParams = config.serviceParams;
|
|
45
|
-
Object.assign(serviceParams, {bookmark: bookmarkServiceParams, ks: ks});
|
|
46
|
-
request.params = JSON.stringify(serviceParams);
|
|
47
|
-
return request;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
import RequestBuilder from '../../../../util/request-builder';
|
|
3
|
-
import OTTConfiguration from '../../config';
|
|
4
|
-
import OTTBookmarkService from './bookmark-service';
|
|
5
|
-
|
|
6
|
-
declare var __VERSION__: string;
|
|
7
|
-
declare var __NAME__: string;
|
|
8
|
-
|
|
9
|
-
const NAME = __NAME__ + '-bookmark-service';
|
|
10
|
-
const VERSION = __VERSION__;
|
|
11
|
-
|
|
12
|
-
export {OTTBookmarkService, OTTConfiguration, RequestBuilder, NAME, VERSION};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
//@flow
|
|
2
|
-
import MultiRequestBuilder from '../../common/multi-request-builder';
|
|
3
|
-
import OTTConfiguration from '../config';
|
|
4
|
-
|
|
5
|
-
const SERVICE_NAME: string = 'multirequest';
|
|
6
|
-
|
|
7
|
-
export default class OTTService {
|
|
8
|
-
/**
|
|
9
|
-
* Gets a new instance of MultiRequestBuilder with ott params
|
|
10
|
-
* @function getMultiRequest
|
|
11
|
-
* @param {string} ks The ks
|
|
12
|
-
* @param {string} partnerId The partner ID
|
|
13
|
-
* @returns {MultiRequestBuilder} The multi request builder
|
|
14
|
-
* @static
|
|
15
|
-
*/
|
|
16
|
-
static getMultiRequest(ks: string, partnerId?: number): MultiRequestBuilder {
|
|
17
|
-
const config = OTTConfiguration.get();
|
|
18
|
-
const ottParams = config.serviceParams;
|
|
19
|
-
if (ks) {
|
|
20
|
-
Object.assign(ottParams, {ks: ks});
|
|
21
|
-
}
|
|
22
|
-
if (partnerId) {
|
|
23
|
-
Object.assign(ottParams, {partnerId: partnerId});
|
|
24
|
-
}
|
|
25
|
-
const headers: Map<string, string> = new Map();
|
|
26
|
-
headers.set('Content-Type', 'application/json');
|
|
27
|
-
const multiReq = new MultiRequestBuilder(headers);
|
|
28
|
-
multiReq.method = 'POST';
|
|
29
|
-
multiReq.service = SERVICE_NAME;
|
|
30
|
-
multiReq.url = multiReq.getUrl(config.serviceUrl);
|
|
31
|
-
multiReq.params = ottParams;
|
|
32
|
-
return multiReq;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
//@flow
|
|
2
|
-
import OTTService from './ott-service';
|
|
3
|
-
import RequestBuilder from '../../../util/request-builder';
|
|
4
|
-
|
|
5
|
-
const SERVICE_NAME: string = 'ottuser';
|
|
6
|
-
|
|
7
|
-
export default class OTTUserService extends OTTService {
|
|
8
|
-
/**
|
|
9
|
-
* Creates an instance of RequestBuilder for session.startWidgetSession
|
|
10
|
-
* @function anonymousSession
|
|
11
|
-
* @param {string} serviceUrl The service base URL
|
|
12
|
-
* @param {string} partnerId The partner ID
|
|
13
|
-
* @param {string} udid The udid
|
|
14
|
-
* @returns {RequestBuilder} The request builder
|
|
15
|
-
* @static
|
|
16
|
-
*/
|
|
17
|
-
static anonymousLogin(serviceUrl: string, partnerId: number, udid?: string): RequestBuilder {
|
|
18
|
-
const headers: Map<string, string> = new Map();
|
|
19
|
-
headers.set('Content-Type', 'application/json');
|
|
20
|
-
const request = new RequestBuilder(headers);
|
|
21
|
-
request.service = SERVICE_NAME;
|
|
22
|
-
request.action = 'anonymousLogin';
|
|
23
|
-
request.method = 'POST';
|
|
24
|
-
request.url = request.getUrl(serviceUrl);
|
|
25
|
-
const params: Object = {partnerId: partnerId};
|
|
26
|
-
if (udid) {
|
|
27
|
-
Object.assign(params, {udid: udid});
|
|
28
|
-
}
|
|
29
|
-
request.params = params;
|
|
30
|
-
return request;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
//@flow
|
|
2
|
-
import {clone} from '../../util/clone';
|
|
3
|
-
|
|
4
|
-
const defaultConfig: Object = {
|
|
5
|
-
serviceUrl: 'https://cdnapisec.kaltura.com/api_v3',
|
|
6
|
-
cdnUrl: 'https://cdnapisec.kaltura.com',
|
|
7
|
-
serviceParams: {
|
|
8
|
-
apiVersion: '3.3.0',
|
|
9
|
-
format: 1
|
|
10
|
-
},
|
|
11
|
-
useApiCaptions: true,
|
|
12
|
-
loadThumbnailWithKs: false,
|
|
13
|
-
replaceHostOnlyManifestUrls: false
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export default class OVPConfiguration {
|
|
17
|
-
static set(clientConfig?: ProviderEnvConfigObject) {
|
|
18
|
-
if (clientConfig) {
|
|
19
|
-
Object.assign(defaultConfig, clientConfig);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
static get(): Object {
|
|
24
|
-
return clone(defaultConfig);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export {OVPConfiguration};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import {addKsToUrl} from './provider-parser';
|
|
4
|
-
|
|
5
|
-
const KalturaCaptionType: CaptionType = {
|
|
6
|
-
SRT: '1',
|
|
7
|
-
DFXP: '2',
|
|
8
|
-
WEBVTT: '3',
|
|
9
|
-
CAP: '4'
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const CaptionsFormatsMap: {[format: string]: string} = {
|
|
13
|
-
'3': 'vtt',
|
|
14
|
-
'1': 'srt'
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
class ExternalCaptionsBuilder {
|
|
18
|
-
static createConfig(captions: Array<Object>, ks: string): Array<PKExternalCaptionObject> {
|
|
19
|
-
return captions.map(caption => {
|
|
20
|
-
let url = caption.url;
|
|
21
|
-
let type = CaptionsFormatsMap[caption.format];
|
|
22
|
-
if ([KalturaCaptionType.DFXP, KalturaCaptionType.CAP].includes(caption.format)) {
|
|
23
|
-
url = caption.webVttUrl;
|
|
24
|
-
type = CaptionsFormatsMap[KalturaCaptionType.WEBVTT];
|
|
25
|
-
}
|
|
26
|
-
url = addKsToUrl(url, ks);
|
|
27
|
-
return {
|
|
28
|
-
default: !!caption.isDefault,
|
|
29
|
-
type: type,
|
|
30
|
-
language: caption.languageCode,
|
|
31
|
-
label: caption.label,
|
|
32
|
-
url: url
|
|
33
|
-
};
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export {ExternalCaptionsBuilder};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
import OVPProvider from './provider';
|
|
3
|
-
import OVPProviderParser from './provider-parser';
|
|
4
|
-
import RequestBuilder from '../../util/request-builder';
|
|
5
|
-
import * as ResponseTypes from './response-types';
|
|
6
|
-
|
|
7
|
-
declare var __VERSION__: string;
|
|
8
|
-
declare var __NAME__: string;
|
|
9
|
-
|
|
10
|
-
const NAME = __NAME__ + '-ovp';
|
|
11
|
-
const VERSION = __VERSION__;
|
|
12
|
-
|
|
13
|
-
export {OVPProvider as Provider, OVPProviderParser as ProviderParser, NAME, VERSION, RequestBuilder, ResponseTypes};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
import DataLoaderManager from '../../common/data-loader-manager';
|
|
3
|
-
import OVPService from '../services/ovp-service';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* OTTDataLoaderManager is a class that handles the OVP data loading
|
|
7
|
-
* @param {string} playerVersion - player version
|
|
8
|
-
* @param {string} partnerId - partner id
|
|
9
|
-
* @param {string} ks - ks
|
|
10
|
-
* @param {ProviderNetworkRetryParameters} [networkRetryConfig] - network retry configuration
|
|
11
|
-
*/
|
|
12
|
-
export default class OVPDataLoaderManager extends DataLoaderManager {
|
|
13
|
-
constructor(playerVersion: string, partnerId: number, ks: string = '', networkRetryConfig: ProviderNetworkRetryParameters) {
|
|
14
|
-
super(networkRetryConfig);
|
|
15
|
-
this._multiRequest = OVPService.getMultiRequest(playerVersion, ks, partnerId);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
//@flow
|
|
2
|
-
import RequestBuilder from '../../../util/request-builder';
|
|
3
|
-
import OVPConfiguration from '../config';
|
|
4
|
-
import OVPBaseEntryService from '../services/base-entry-service';
|
|
5
|
-
import {KalturaBaseEntryListResponse} from '../response-types/kaltura-base-entry-list-response';
|
|
6
|
-
|
|
7
|
-
export default class OVPEntryListLoader implements ILoader {
|
|
8
|
-
_entries: Array<string>;
|
|
9
|
-
_requests: Array<RequestBuilder>;
|
|
10
|
-
_response: any = {playlistItems: {entries: []}};
|
|
11
|
-
|
|
12
|
-
static get id(): string {
|
|
13
|
-
return 'entry_list';
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @constructor
|
|
18
|
-
* @param {Object} params loader params
|
|
19
|
-
*/
|
|
20
|
-
constructor(params: Object) {
|
|
21
|
-
this.requests = this.buildRequests(params);
|
|
22
|
-
this._entries = params.entries;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
set requests(requests: Array<RequestBuilder>) {
|
|
26
|
-
this._requests = requests;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
get requests(): Array<RequestBuilder> {
|
|
30
|
-
return this._requests;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
set response(response: any) {
|
|
34
|
-
let mediaEntryResponse: KalturaBaseEntryListResponse;
|
|
35
|
-
response.forEach(item => {
|
|
36
|
-
mediaEntryResponse = new KalturaBaseEntryListResponse(item.data);
|
|
37
|
-
this._response.playlistItems.entries.push(mediaEntryResponse.entries[0]);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
get response(): any {
|
|
42
|
-
return this._response;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Builds loader requests
|
|
47
|
-
* @function
|
|
48
|
-
* @param {Object} params Requests parameters
|
|
49
|
-
* @returns {RequestBuilder} The request builder
|
|
50
|
-
* @static
|
|
51
|
-
*/
|
|
52
|
-
buildRequests(params: Object): Array<RequestBuilder> {
|
|
53
|
-
const config = OVPConfiguration.get();
|
|
54
|
-
const requests: Array<RequestBuilder> = [];
|
|
55
|
-
params.entries.forEach(entry => {
|
|
56
|
-
requests.push(OVPBaseEntryService.list(config.serviceUrl, params.ks, entry.entryId || entry, params.redirectFromEntryId, entry.referenceId));
|
|
57
|
-
});
|
|
58
|
-
return requests;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Loader validation function
|
|
63
|
-
* @function
|
|
64
|
-
* @returns {boolean} Is valid
|
|
65
|
-
*/
|
|
66
|
-
isValid(): boolean {
|
|
67
|
-
return !!(this._entries && this._entries.length);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
//@flow
|
|
2
|
-
import RequestBuilder from '../../../util/request-builder';
|
|
3
|
-
import OVPBaseEntryService from '../services/base-entry-service';
|
|
4
|
-
import OVPMetadataService from '../services/meta-data-service';
|
|
5
|
-
import OVPConfiguration from '../config';
|
|
6
|
-
import {KalturaPlaybackContext} from '../response-types/kaltura-playback-context';
|
|
7
|
-
import {KalturaMetadataListResponse} from '../response-types/kaltura-metadata-list-response';
|
|
8
|
-
import {KalturaBaseEntryListResponse} from '../response-types/kaltura-base-entry-list-response';
|
|
9
|
-
import {KalturaMediaEntry} from '../response-types/kaltura-media-entry';
|
|
10
|
-
|
|
11
|
-
type OVPMediaEntryLoaderResponse = {
|
|
12
|
-
entry: KalturaMediaEntry,
|
|
13
|
-
playBackContextResult: KalturaPlaybackContext,
|
|
14
|
-
metadataListResult: KalturaMetadataListResponse
|
|
15
|
-
};
|
|
16
|
-
export type {OVPMediaEntryLoaderResponse};
|
|
17
|
-
|
|
18
|
-
export default class OVPMediaEntryLoader implements ILoader {
|
|
19
|
-
_entryId: string;
|
|
20
|
-
_referenceId: string;
|
|
21
|
-
_requests: Array<RequestBuilder>;
|
|
22
|
-
_response: any = {};
|
|
23
|
-
|
|
24
|
-
static get id(): string {
|
|
25
|
-
return 'media';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @constructor
|
|
30
|
-
* @param {Object} params loader params
|
|
31
|
-
* @boolean {boolean} useExternalCaptions - if we should add captions request to the multirequests.
|
|
32
|
-
*/
|
|
33
|
-
constructor(params: Object) {
|
|
34
|
-
this.requests = this.buildRequests(params);
|
|
35
|
-
this._entryId = params.entryId;
|
|
36
|
-
this._referenceId = params.referenceId;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
set requests(requests: Array<RequestBuilder>) {
|
|
40
|
-
this._requests = requests;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
get requests(): Array<RequestBuilder> {
|
|
44
|
-
return this._requests;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
set response(response: any) {
|
|
48
|
-
let mediaEntryResponse: KalturaBaseEntryListResponse = new KalturaBaseEntryListResponse(response[0].data);
|
|
49
|
-
this._response.entry = mediaEntryResponse.entries[0];
|
|
50
|
-
this._response.playBackContextResult = new KalturaPlaybackContext(response[1].data);
|
|
51
|
-
this._response.metadataListResult = new KalturaMetadataListResponse(response[2].data);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
get response(): OVPMediaEntryLoaderResponse {
|
|
55
|
-
return this._response;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Builds loader requests
|
|
60
|
-
* @function
|
|
61
|
-
* @param {Object} params Requests parameters
|
|
62
|
-
* @returns {RequestBuilder} The request builder
|
|
63
|
-
* @static
|
|
64
|
-
*/
|
|
65
|
-
buildRequests(params: Object): Array<RequestBuilder> {
|
|
66
|
-
const config = OVPConfiguration.get();
|
|
67
|
-
const requests: Array<RequestBuilder> = [];
|
|
68
|
-
requests.push(OVPBaseEntryService.list(config.serviceUrl, params.ks, params.entryId, params.redirectFromEntryId, params.referenceId));
|
|
69
|
-
// Use the entry id from the request result to support loading by referenceId
|
|
70
|
-
const serviceEntryId = params.ks === '{1:result:ks}' ? '{2:result:objects:0:id}' : '{1:result:objects:0:id}';
|
|
71
|
-
requests.push(OVPBaseEntryService.getPlaybackContext(config.serviceUrl, params.ks, serviceEntryId));
|
|
72
|
-
requests.push(OVPMetadataService.list(config.serviceUrl, params.ks, serviceEntryId));
|
|
73
|
-
return requests;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Loader validation function
|
|
78
|
-
* @function
|
|
79
|
-
* @returns {boolean} Is valid
|
|
80
|
-
*/
|
|
81
|
-
isValid(): boolean {
|
|
82
|
-
return !!(this._entryId || this._referenceId);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
//@flow
|
|
2
|
-
import RequestBuilder from '../../../util/request-builder';
|
|
3
|
-
import OVPPlaylistService from '../services/playlist-service';
|
|
4
|
-
import OVPConfiguration from '../config';
|
|
5
|
-
import {KalturaPlaylist} from '../response-types/kaltura-playlist';
|
|
6
|
-
import {KalturaMediaEntries} from '../response-types/kaltura-media-entries';
|
|
7
|
-
|
|
8
|
-
export default class OVPPlaylistLoader implements ILoader {
|
|
9
|
-
_playlistId: string;
|
|
10
|
-
_requests: Array<RequestBuilder>;
|
|
11
|
-
_response: any = {};
|
|
12
|
-
|
|
13
|
-
static get id(): string {
|
|
14
|
-
return 'playlist';
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @constructor
|
|
19
|
-
* @param {Object} params loader params
|
|
20
|
-
*/
|
|
21
|
-
constructor(params: Object) {
|
|
22
|
-
this.requests = this.buildRequests(params);
|
|
23
|
-
this._playlistId = params.playlistId;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
set requests(requests: Array<RequestBuilder>) {
|
|
27
|
-
this._requests = requests;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
get requests(): Array<RequestBuilder> {
|
|
31
|
-
return this._requests;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
set response(response: any) {
|
|
35
|
-
this._response.playlistData = new KalturaPlaylist(response[0].data);
|
|
36
|
-
this._response.playlistItems = new KalturaMediaEntries(response[1].data);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
get response(): any {
|
|
40
|
-
return this._response;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Builds loader requests
|
|
45
|
-
* @function
|
|
46
|
-
* @param {Object} params Requests parameters
|
|
47
|
-
* @returns {RequestBuilder} The request builder
|
|
48
|
-
* @static
|
|
49
|
-
*/
|
|
50
|
-
buildRequests(params: Object): Array<RequestBuilder> {
|
|
51
|
-
const config = OVPConfiguration.get();
|
|
52
|
-
const requests: Array<RequestBuilder> = [];
|
|
53
|
-
requests.push(OVPPlaylistService.get(config.serviceUrl, params.ks, params.playlistId));
|
|
54
|
-
requests.push(OVPPlaylistService.execute(config.serviceUrl, params.ks, params.playlistId));
|
|
55
|
-
return requests;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Loader validation function
|
|
60
|
-
* @function
|
|
61
|
-
* @returns {boolean} Is valid
|
|
62
|
-
*/
|
|
63
|
-
isValid(): boolean {
|
|
64
|
-
return !!this._playlistId;
|
|
65
|
-
}
|
|
66
|
-
}
|