@playkit-js/playkit-js-providers 2.40.1-canary.0-f2a1cb3 → 2.40.2-canary.0-c7a43ae

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.
Files changed (135) hide show
  1. package/dist/index.d.ts +1624 -0
  2. package/dist/playkit-analytics-service.js +1 -1
  3. package/dist/playkit-analytics-service.js.map +1 -1
  4. package/dist/playkit-bookmark-service.js +1 -1
  5. package/dist/playkit-bookmark-service.js.map +1 -1
  6. package/dist/playkit-ott-provider.js +1 -1
  7. package/dist/playkit-ott-provider.js.map +1 -1
  8. package/dist/playkit-ovp-provider.js +1 -1
  9. package/dist/playkit-ovp-provider.js.map +1 -1
  10. package/dist/playkit-stats-service.js +1 -1
  11. package/dist/playkit-stats-service.js.map +1 -1
  12. package/dist/tsdoc-metadata.json +11 -0
  13. package/flow-typed/types/media-config-sources.js +1 -1
  14. package/flow-typed/types/media-sources.js +1 -1
  15. package/package.json +49 -46
  16. package/playkit-analytics-service/package.json +5 -0
  17. package/playkit-bookmark-service/package.json +5 -0
  18. package/playkit-ott-provider/package.json +5 -0
  19. package/playkit-ovp-provider/package.json +5 -0
  20. package/playkit-stats-service/package.json +5 -0
  21. package/src/entities/bumper.ts +21 -0
  22. package/src/entities/drm.ts +47 -0
  23. package/src/entities/entry-list.ts +13 -0
  24. package/src/entities/image-source.ts +36 -0
  25. package/src/entities/media-entry.ts +104 -0
  26. package/src/entities/media-format.ts +47 -0
  27. package/src/entities/media-source.ts +70 -0
  28. package/src/entities/media-sources.ts +79 -0
  29. package/src/entities/playlist.ts +41 -0
  30. package/src/k-provider/common/base-provider-parser.ts +0 -0
  31. package/src/k-provider/common/base-provider.ts +112 -0
  32. package/src/k-provider/common/base-service-result.ts +56 -0
  33. package/src/k-provider/common/data-loader-manager.ts +115 -0
  34. package/src/k-provider/common/multi-request-builder.ts +111 -0
  35. package/src/k-provider/common/response-types/kaltura-access-control-message.ts +21 -0
  36. package/src/k-provider/common/response-types/kaltura-drm-playback-plugin-data.ts +38 -0
  37. package/src/k-provider/ott/config.ts +22 -0
  38. package/src/k-provider/ott/index.ts +14 -0
  39. package/src/k-provider/ott/loaders/asset-list-loader.ts +68 -0
  40. package/src/k-provider/ott/loaders/asset-loader.ts +69 -0
  41. package/src/k-provider/ott/loaders/data-loader-manager.ts +15 -0
  42. package/src/k-provider/ott/loaders/session-loader.ts +62 -0
  43. package/src/k-provider/ott/provider-parser.ts +285 -0
  44. package/src/k-provider/ott/provider.ts +252 -0
  45. package/src/k-provider/ott/response-types/kaltura-asset.ts +105 -0
  46. package/src/k-provider/ott/response-types/kaltura-bumper-playback-plugin-data.ts +27 -0
  47. package/src/k-provider/ott/response-types/kaltura-playback-context.ts +73 -0
  48. package/src/k-provider/ott/response-types/kaltura-playback-source.ts +62 -0
  49. package/src/k-provider/ott/response-types/kaltura-rule-action.ts +25 -0
  50. package/src/k-provider/ott/services/asset-service.ts +50 -0
  51. package/src/k-provider/ott/services/bookmark/bookmark-service.ts +48 -0
  52. package/src/k-provider/ott/services/bookmark/index.ts +11 -0
  53. package/src/k-provider/ott/services/ott-service.ts +33 -0
  54. package/src/k-provider/ott/services/user-service.ts +31 -0
  55. package/src/k-provider/ovp/config.ts +28 -0
  56. package/src/k-provider/ovp/external-captions-builder.ts +37 -0
  57. package/src/k-provider/ovp/index.ts +13 -0
  58. package/src/k-provider/ovp/loaders/data-loader-manager.ts +17 -0
  59. package/src/k-provider/ovp/loaders/entry-list-loader.ts +69 -0
  60. package/src/k-provider/ovp/loaders/media-entry-loader.ts +84 -0
  61. package/src/k-provider/ovp/loaders/playlist-loader.ts +69 -0
  62. package/src/k-provider/ovp/loaders/session-loader.ts +62 -0
  63. package/src/k-provider/ovp/loaders/ui-config-loader.ts +71 -0
  64. package/src/k-provider/ovp/play-source-url-builder.ts +59 -0
  65. package/src/k-provider/ovp/provider-parser.ts +461 -0
  66. package/src/k-provider/ovp/provider.ts +358 -0
  67. package/src/k-provider/ovp/regex-action-handler.ts +149 -0
  68. package/src/k-provider/ovp/request-params/base-entry-response-profile.ts +28 -0
  69. package/src/k-provider/ovp/response-types/index.ts +21 -0
  70. package/src/k-provider/ovp/response-types/kaltura-access-control-modify-request-host-regex-action.ts +35 -0
  71. package/src/k-provider/ovp/response-types/kaltura-base-entry-list-response.ts +30 -0
  72. package/src/k-provider/ovp/response-types/kaltura-bumper.ts +25 -0
  73. package/src/k-provider/ovp/response-types/kaltura-flavor-asset.ts +108 -0
  74. package/src/k-provider/ovp/response-types/kaltura-media-entries.ts +28 -0
  75. package/src/k-provider/ovp/response-types/kaltura-media-entry.ts +189 -0
  76. package/src/k-provider/ovp/response-types/kaltura-metadata-list-response.ts +22 -0
  77. package/src/k-provider/ovp/response-types/kaltura-metadata.ts +50 -0
  78. package/src/k-provider/ovp/response-types/kaltura-playback-context.ts +95 -0
  79. package/src/k-provider/ovp/response-types/kaltura-playback-source.ts +89 -0
  80. package/src/k-provider/ovp/response-types/kaltura-playlist.ts +33 -0
  81. package/src/k-provider/ovp/response-types/kaltura-rule-action.ts +27 -0
  82. package/src/k-provider/ovp/response-types/kaltura-ui-conf-response.ts +89 -0
  83. package/src/k-provider/ovp/response-types/kaltura-user-entry-list-response.ts +30 -0
  84. package/src/k-provider/ovp/response-types/kaltura-user-entry.ts +57 -0
  85. package/src/k-provider/ovp/services/analytics/analytics-service.ts +58 -0
  86. package/src/k-provider/ovp/services/analytics/index.ts +11 -0
  87. package/src/k-provider/ovp/services/base-entry-service.ts +75 -0
  88. package/src/k-provider/ovp/services/meta-data-service.ts +29 -0
  89. package/src/k-provider/ovp/services/ovp-service.ts +32 -0
  90. package/src/k-provider/ovp/services/playlist-service.ts +95 -0
  91. package/src/k-provider/ovp/services/session-service.ts +27 -0
  92. package/src/k-provider/ovp/services/stats/index.ts +11 -0
  93. package/src/k-provider/ovp/services/stats/stats-service.ts +32 -0
  94. package/src/k-provider/ovp/services/ui-conf-service.ts +32 -0
  95. package/src/types/adapter-data-config.ts +1 -0
  96. package/src/types/caption-type.ts +1 -0
  97. package/src/types/drm-data.ts +5 -0
  98. package/src/types/entry-list.ts +6 -0
  99. package/src/types/env-config.ts +7 -0
  100. package/src/types/external-caption-object.ts +7 -0
  101. package/src/types/filter-options.ts +3 -0
  102. package/src/types/index.ts +34 -0
  103. package/src/types/loader.ts +7 -0
  104. package/src/types/media-config-metadata.ts +13 -0
  105. package/src/types/media-config-session.ts +6 -0
  106. package/src/types/media-config-sources.ts +20 -0
  107. package/src/types/media-config.ts +8 -0
  108. package/src/types/media-entry.ts +16 -0
  109. package/src/types/media-format.ts +5 -0
  110. package/src/types/media-info.ts +21 -0
  111. package/src/types/media-source.ts +12 -0
  112. package/src/types/media-sources.ts +11 -0
  113. package/src/types/network-retry-parameters.ts +5 -0
  114. package/src/types/playback-context.ts +10 -0
  115. package/src/types/playlist-info.ts +4 -0
  116. package/src/types/playlist-item.ts +5 -0
  117. package/src/types/playlist-metadata.ts +4 -0
  118. package/src/types/playlist.ts +10 -0
  119. package/src/types/poster.ts +5 -0
  120. package/src/types/provider-options.ts +17 -0
  121. package/src/types/request-loader.ts +6 -0
  122. package/src/util/clone.ts +23 -0
  123. package/src/util/error/category.ts +11 -0
  124. package/src/util/error/code.ts +77 -0
  125. package/src/util/error/error.ts +47 -0
  126. package/src/util/error/severity.ts +21 -0
  127. package/src/util/logger.ts +108 -0
  128. package/src/util/param.ts +45 -0
  129. package/src/util/request-builder.ts +187 -0
  130. package/src/util/xml-parser.ts +39 -0
  131. package/CHANGELOG.md +0 -959
  132. package/samples/ott/bookmark.html +0 -23
  133. package/samples/ott/provider.html +0 -28
  134. package/samples/ovp/provider.html +0 -30
  135. package/samples/ovp/stats.html +0 -17
@@ -0,0 +1,108 @@
1
+ export class KalturaFlavorAsset {
2
+ public static Status: {[status: string]: number} = {
3
+ ERROR: -1,
4
+ QUEUED: 0,
5
+ CONVERTING: 1,
6
+ READY: 2,
7
+ DELETED: 3,
8
+ NOT_APPLICABLE: 4,
9
+ TEMP: 5,
10
+ WAIT_FOR_CONVERT: 6,
11
+ IMPORTING: 7,
12
+ VALIDATING: 8,
13
+ EXPORTING: 9
14
+ };
15
+
16
+ /**
17
+ * @member - The ID of the Flavor Asset
18
+ * @type {string}
19
+ */
20
+ public id: string;
21
+ /**
22
+ * @member -The Flavor Params used to create this Flavor Asset
23
+ * @type {string}
24
+ */
25
+ public flavorParamsId: string;
26
+ /**
27
+ * @member -The file extension
28
+ * @type {string}
29
+ */
30
+ public fileExt: string;
31
+ /**
32
+ * @member - The overall bitrate (in KBits) of the Flavor Asset
33
+ * @type {string}
34
+ */
35
+ public bitrate: number;
36
+ /**
37
+ * @member - The width of the Flavor Asset
38
+ * @type {number}
39
+ */
40
+ public width: number;
41
+ /**
42
+ * @member - The height of the Flavor Asset
43
+ * @type {number}
44
+ */
45
+ public height: number;
46
+ /**
47
+ * @member - The frame rate (in FPS) of the Flavor Asset
48
+ * @type {number}
49
+ */
50
+ public frameRate: number;
51
+ /**
52
+ * @member - True if this Flavor Asset is the original source
53
+ * @type {number}
54
+ */
55
+ public isOriginal: boolean;
56
+ /**
57
+ * @member - True if this Flavor Asset is playable in KDP
58
+ * @type {boolean}
59
+ */
60
+ public isWeb: boolean;
61
+ /**
62
+ * @member - The container format
63
+ * @type {boolean}
64
+ */
65
+ public containerFormat: string;
66
+ /**
67
+ *@member - The video codec
68
+ * @type {boolean}
69
+ */
70
+ public videoCodecId: string;
71
+ /**
72
+ * @member - The status of the Flavor Asset
73
+ * @type {number}
74
+ */
75
+ public status: number;
76
+ /**
77
+ * @member - The language of the flavor asset
78
+ * @type {Status}
79
+ */
80
+ public language: string;
81
+ /**
82
+ * @member - The label of the flavor asset
83
+ * @type {string}
84
+ */
85
+ public label: string;
86
+
87
+ /**
88
+ * @constructor
89
+ * @param {Object} data The json response
90
+ */
91
+ constructor(data: any) {
92
+ this.id = data.id;
93
+ this.flavorParamsId = data.flavorParamsId;
94
+ this.fileExt = data.fileExt;
95
+ this.bitrate = data.bitrate;
96
+ this.width = data.width;
97
+ this.height = data.height;
98
+ this.id = data.id;
99
+ this.frameRate = data.frameRate;
100
+ this.isOriginal = data.isOriginal;
101
+ this.isWeb = data.isWeb;
102
+ this.containerFormat = data.containerFormat;
103
+ this.videoCodecId = data.videoCodecId;
104
+ this.status = data.status;
105
+ this.language = data.language;
106
+ this.label = data.label;
107
+ }
108
+ }
@@ -0,0 +1,28 @@
1
+ import ServiceResult from '../../common/base-service-result';
2
+ import {KalturaMediaEntry} from './kaltura-media-entry';
3
+
4
+ export class KalturaMediaEntries extends ServiceResult {
5
+ /**
6
+ * @member - The entries
7
+ * @type {Array<KalturaMediaEntry>}
8
+ */
9
+ public entries!: Array<KalturaMediaEntry>;
10
+
11
+ /**
12
+ * @constructor
13
+ * @param {Object} responseObj The json response
14
+ */
15
+ constructor(responseObj: any) {
16
+ super(responseObj);
17
+ if (!this.hasError) {
18
+ this.entries = [];
19
+ responseObj.map(entry => {
20
+ const kalturaMediaEntry = new KalturaMediaEntry(entry);
21
+ if (kalturaMediaEntry.type !== KalturaMediaEntry.EntryType.DOCUMENT.value) {
22
+ // filter out documents
23
+ this.entries.push(kalturaMediaEntry);
24
+ }
25
+ });
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,189 @@
1
+ export class KalturaMediaEntry {
2
+ public static EntryType: {[entryType: string]: {value: number | string}} = {
3
+ AUTOMATIC: {value: -1},
4
+ EXTERNAL_MEDIA: {value: 'externalMedia.externalMedia'},
5
+ MEDIA_CLIP: {value: 1},
6
+ MIX: {value: 2},
7
+ PLAYLIST: {value: 5},
8
+ DATA: {value: 6},
9
+ LIVE_STREAM: {value: 7},
10
+ LIVE_CHANNEL: {value: 8},
11
+ DOCUMENT: {value: 10}
12
+ };
13
+
14
+ public static MediaType: {[mediaType: string]: {value: number}} = {
15
+ VIDEO: {value: 1},
16
+ IMAGE: {value: 2},
17
+ AUDIO: {value: 5},
18
+ LIVE_STREAM_FLASH: {value: 201},
19
+ LIVE_STREAM_WINDOWS_MEDIA: {value: 202},
20
+ LIVE_STREAM_REAL_MEDIA: {value: 203},
21
+ LIVE_STREAM_QUICK_TIME: {value: 204}
22
+ };
23
+
24
+ public static EntryStatus: {[status: string]: string | number} = {
25
+ ERROR_IMPORTING: -2,
26
+ ERROR_CONVERTING: -1,
27
+ SCAN_FAILURE: 'virusScan.ScanFailure',
28
+ IMPORT: 0,
29
+ INFECTED: 'virusScan.Infected',
30
+ PRECONVERT: 1,
31
+ READY: 2,
32
+ DELETED: 3,
33
+ PENDING: 4,
34
+ MODERATE: 5,
35
+ BLOCKED: 6,
36
+ NO_CONTENT: 7
37
+ };
38
+
39
+ public static EntryModerationStatus: {[status: string]: number} = {
40
+ PENDING_MODERATION: 1,
41
+ APPROVED: 2,
42
+ REJECTED: 3,
43
+ FLAGGED_FOR_REVIEW: 4,
44
+ MODERATE: 5,
45
+ AUTO_APPROVED: 6
46
+ };
47
+
48
+ /**
49
+ * @member - The entry id
50
+ * @type {string}
51
+ */
52
+ public id: string;
53
+ /**
54
+ * @member - The entry referenceId
55
+ * @type {string}
56
+ */
57
+ public referenceId: string;
58
+ /**
59
+ * @member - The entry externalSourceType
60
+ * @type {string}
61
+ */
62
+ public externalSourceType: string;
63
+ /**
64
+ * @member - Entry name (Min 1 chars)
65
+ * @type {string}
66
+ */
67
+ public name: string;
68
+ /**
69
+ * @member - Entry description
70
+ * @type {string}
71
+ */
72
+ public description: string;
73
+ /**
74
+ * @member - The URL used for playback. This is not the download URL.
75
+ * @type {string}
76
+ */
77
+ public dataUrl: string;
78
+ /**
79
+ * @member - Comma separated flavor params ids that exists for this media entry
80
+ * @type {string}
81
+ */
82
+ public flavorParamsIds: string;
83
+ /**
84
+ * @member - The entry duration
85
+ * @type {number}
86
+ */
87
+ public duration: number;
88
+ /**
89
+ * @member - The type of the entry, this is auto filled by the derived entry object
90
+ * @type {string | number}
91
+ */
92
+ public type: string | number;
93
+ /**
94
+ * @member - The type of the entry, this is auto filled by the derived entry object (Image, Audio etc.)
95
+ * @type {number}
96
+ */
97
+ public entryType: number;
98
+ /**
99
+ * @member - Entry poster image
100
+ * @type {string}
101
+ */
102
+ public poster: string;
103
+ /**
104
+ * @member - DVR status
105
+ * @type {number}
106
+ */
107
+ public dvrStatus: number;
108
+ /**
109
+ * @member - Entry tags
110
+ * @type {string}
111
+ */
112
+ public tags: string;
113
+
114
+ /**
115
+ * @member - Entry status
116
+ * @type {number}
117
+ */
118
+ public status: number;
119
+
120
+ /**
121
+ * @member - Entry creation date as Unix timestamp (In seconds)
122
+ * @type {number}
123
+ */
124
+ public createdAt: number;
125
+
126
+ /**
127
+ * @member - Entry updation date as Unix timestamp (In seconds)
128
+ * @type {number}
129
+ */
130
+ public updatedAt: number;
131
+
132
+ /**
133
+ * @member - Entry end date as Unix timestamp (In seconds)
134
+ * @type {number}
135
+ */
136
+ public endDate: number;
137
+
138
+ /**
139
+ * @member - Number of plays
140
+ * @type {number}
141
+ */
142
+ public plays: number;
143
+
144
+ /**
145
+ * @member - Number of views
146
+ * @type {number}
147
+ */
148
+ public views: number;
149
+
150
+ /**
151
+ * @member - The download URL of the entry.
152
+ * @type {string}
153
+ */
154
+ public downloadUrl: string;
155
+
156
+ /**
157
+ * @member - ID of entry creator.
158
+ * @type {string}
159
+ */
160
+ public creatorId: string;
161
+
162
+ /**
163
+ * @constructor
164
+ * @param {Object} entry The json response
165
+ */
166
+ constructor(entry: any) {
167
+ this.id = entry.id;
168
+ this.referenceId = entry.referenceId;
169
+ this.externalSourceType = entry.externalSourceType;
170
+ this.name = entry.name;
171
+ this.description = entry.description;
172
+ this.dataUrl = entry.dataUrl;
173
+ this.type = entry.type;
174
+ this.entryType = entry.mediaType;
175
+ this.flavorParamsIds = entry.flavorParamsIds;
176
+ this.duration = entry.duration;
177
+ this.poster = entry.thumbnailUrl;
178
+ this.status = entry.status;
179
+ this.dvrStatus = entry.dvrStatus;
180
+ this.tags = entry.tags;
181
+ this.createdAt = entry.createdAt;
182
+ this.updatedAt = entry.updatedAt;
183
+ this.creatorId = entry.creatorId;
184
+ this.endDate = entry.endDate;
185
+ this.plays = entry.plays;
186
+ this.views = entry.views;
187
+ this.downloadUrl = entry.downloadUrl;
188
+ }
189
+ }
@@ -0,0 +1,22 @@
1
+ import ServiceResult from '../../common/base-service-result';
2
+ import {KalturaMetadata} from './kaltura-metadata';
3
+
4
+ export class KalturaMetadataListResponse extends ServiceResult {
5
+ public totalCount!: number;
6
+ public metas!: Array<KalturaMetadata>;
7
+
8
+ /**
9
+ * @constructor
10
+ * @param {Object} responseObj The response
11
+ */
12
+ constructor(responseObj: any) {
13
+ super(responseObj);
14
+ if (!this.hasError) {
15
+ this.totalCount = responseObj.totalCount;
16
+ if (this.totalCount > 0) {
17
+ this.metas = [];
18
+ responseObj.objects.map(meta => this.metas.push(new KalturaMetadata(meta)));
19
+ }
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,50 @@
1
+ export class KalturaMetadata {
2
+ public static ObjectType: {[type: string]: string | number} = {
3
+ AD_CUE_POINT: 'adCuePointMetadata.AdCuePoint',
4
+ ANNOTATION: 'annotationMetadata.Annotation',
5
+ CODE_CUE_POINT: 'codeCuePointMetadata.CodeCuePoint',
6
+ THUMB_CUE_POINT: 'thumbCuePointMetadata.thumbCuePoint',
7
+ ENTRY: 1,
8
+ CATEGORY: 2,
9
+ USER: 3,
10
+ PARTNER: 4,
11
+ DYNAMIC_OBJECT: 5
12
+ };
13
+
14
+ public static Status: {[status: string]: number} = {
15
+ VALID: 1,
16
+ INVALID: 2,
17
+ DELETED: 3
18
+ };
19
+
20
+ public id: number;
21
+ public metadataProfileId: number;
22
+ public metadataProfileVersion: number;
23
+ public metadataObjectType: string | number;
24
+ public objectId: string;
25
+ public version: number;
26
+ public created: Date;
27
+ public updated: Date;
28
+ public status: number;
29
+ public xml: string;
30
+
31
+ /**
32
+ * @constructor
33
+ * @param {Object} data The response
34
+ */
35
+ constructor(data: any) {
36
+ this.id = data.id;
37
+ this.metadataProfileId = data.metadataProfileId;
38
+ this.metadataProfileVersion = data.metadataProfileVersion;
39
+ this.metadataProfileId = data.metadataProfileId;
40
+ this.metadataObjectType = data.metadataObjectType;
41
+ this.objectId = data.objectId;
42
+ this.version = data.version;
43
+ this.created = new Date(0);
44
+ this.created.setUTCSeconds(data.createdAt);
45
+ this.updated = new Date(0);
46
+ this.updated.setUTCSeconds(data.updatedAt);
47
+ this.status = data.status;
48
+ this.xml = data.xml;
49
+ }
50
+ }
@@ -0,0 +1,95 @@
1
+ import ServiceResult from '../../common/base-service-result';
2
+ import {KalturaAccessControlMessage} from '../../common/response-types/kaltura-access-control-message';
3
+ import {KalturaPlaybackSource} from './kaltura-playback-source';
4
+ import {KalturaAccessControlModifyRequestHostRegexAction} from './kaltura-access-control-modify-request-host-regex-action';
5
+ import {KalturaRuleAction} from './kaltura-rule-action';
6
+ import {KalturaFlavorAsset} from './kaltura-flavor-asset';
7
+ import {KalturaBumper} from './kaltura-bumper';
8
+
9
+ export class KalturaPlaybackContext extends ServiceResult {
10
+ /**
11
+ * @member - The playback sources
12
+ * @type {Array<KalturaPlaybackSource>}
13
+ */
14
+ public sources: Array<KalturaPlaybackSource> = [];
15
+ /**
16
+ * @member - Array of actions as received from the rules that invalidated
17
+ * @type {Array<KalturaRuleAction>}
18
+ */
19
+ public actions: Array<KalturaRuleAction> = [];
20
+ /**
21
+ * @member - Array of actions as received from the rules that invalidated
22
+ * @type {Array<KalturaAccessControlMessage>}
23
+ */
24
+ public messages: Array<KalturaAccessControlMessage> = [];
25
+ /**
26
+ * @member - The flavor assets
27
+ * @type {Array<KalturaFlavorAsset>}
28
+ */
29
+ public flavorAssets: Array<KalturaFlavorAsset> = [];
30
+ /**
31
+ * @member - The bumper data
32
+ * @type {Array<KalturaBumper>}
33
+ */
34
+ public bumperData: Array<KalturaBumper> = [];
35
+
36
+ /**
37
+ * @constructor
38
+ * @param {Object} response The response
39
+ */
40
+ constructor(response: any) {
41
+ super(response);
42
+ if (!this.hasError) {
43
+ const messages = response.messages;
44
+ if (messages) {
45
+ messages.map(message => this.messages.push(new KalturaAccessControlMessage(message)));
46
+ }
47
+ const actions = response.actions;
48
+ if (actions) {
49
+ actions.map(action => {
50
+ if (action.type === KalturaRuleAction.Type.REQUEST_HOST_REGEX) {
51
+ this.actions.push(new KalturaAccessControlModifyRequestHostRegexAction(action));
52
+ } else {
53
+ this.actions.push(new KalturaRuleAction(action));
54
+ }
55
+ });
56
+ }
57
+ const sources = response.sources;
58
+ if (sources) {
59
+ sources.map(source => this.sources.push(new KalturaPlaybackSource(source)));
60
+ }
61
+ const flavorAssets = response.flavorAssets;
62
+ if (flavorAssets) {
63
+ flavorAssets.map(flavor => this.flavorAssets.push(new KalturaFlavorAsset(flavor)));
64
+ }
65
+ const bumperData = response.bumperData;
66
+ if (bumperData) {
67
+ bumperData.map(bumper => this.bumperData.push(new KalturaBumper(bumper)));
68
+ }
69
+ }
70
+ }
71
+
72
+ public hasBlockAction(): boolean {
73
+ return this.getBlockAction() !== undefined;
74
+ }
75
+
76
+ public getBlockAction(): KalturaRuleAction | undefined {
77
+ return this.actions.find(action => action.type === KalturaRuleAction.Type.BLOCK);
78
+ }
79
+
80
+ public getErrorMessages(): Array<KalturaAccessControlMessage> {
81
+ return this.messages;
82
+ }
83
+
84
+ /**
85
+ * Get the KalturaAccessControlModifyRequestHostRegexAction action
86
+ * @function getRequestHostRegexAction
87
+ * @returns {?KalturaAccessControlModifyRequestHostRegexAction} The action
88
+ * */
89
+ public getRequestHostRegexAction(): KalturaAccessControlModifyRequestHostRegexAction | undefined {
90
+ const action = this.actions.find(action => action.type === KalturaRuleAction.Type.REQUEST_HOST_REGEX);
91
+ if (action instanceof KalturaAccessControlModifyRequestHostRegexAction) {
92
+ return action;
93
+ }
94
+ }
95
+ }
@@ -0,0 +1,89 @@
1
+ import {KalturaDrmPlaybackPluginData} from '../../common/response-types/kaltura-drm-playback-plugin-data';
2
+
3
+ export type OVPKalturaPlaybackSource = KalturaPlaybackSource;
4
+
5
+ export class KalturaPlaybackSource {
6
+ /**
7
+ * @member - source format according to delivery profile streamer type (applehttp, mpegdash etc.)
8
+ * @type {string}
9
+ */
10
+ public format: string;
11
+ /**
12
+ * @member - delivery profile Id
13
+ * @type {string}
14
+ */
15
+ public deliveryProfileId: string;
16
+ /**
17
+ * @member - The source URL
18
+ * @type {string}
19
+ */
20
+ public url: string;
21
+ /**
22
+ * @member - comma separated string according to deliveryProfile media protocols ('http,https' etc.)
23
+ * @type {string}
24
+ */
25
+ public protocols: string;
26
+ /**
27
+ * @member - comma separated string of flavor ids
28
+ * @type {string}
29
+ */
30
+ public flavorIds: string;
31
+ /**
32
+ * @member - drm data object containing relevant license url ,scheme name and certificate
33
+ * @type {Array<KalturaDrmPlaybackPluginData>}
34
+ */
35
+ public drm: Array<KalturaDrmPlaybackPluginData> = [];
36
+
37
+ /**
38
+ * @constructor
39
+ * @param {Object} source The response
40
+ */
41
+ constructor(source: any) {
42
+ this.format = source.format;
43
+ this.deliveryProfileId = source.deliveryProfileId;
44
+ this.url = source.url;
45
+ this.protocols = source.protocols;
46
+ this.flavorIds = source.flavorIds;
47
+ if (source.drm) {
48
+ source.drm.map(drm => this.drm.push(new KalturaDrmPlaybackPluginData(drm)));
49
+ }
50
+ }
51
+
52
+ /**
53
+ * Checks if source has DRM data
54
+ * @function hasDrmData
55
+ * @returns {boolean} Is source has DRM
56
+ */
57
+ public hasDrmData(): boolean {
58
+ return this.drm && this.drm.length > 0;
59
+ }
60
+
61
+ /**
62
+ * Checks if source has flavor IDs
63
+ * @function hasFlavorIds
64
+ * @returns {boolean} Is source ha flavor IDs
65
+ */
66
+ public hasFlavorIds(): boolean {
67
+ return !!this.flavorIds && this.flavorIds.length > 0;
68
+ }
69
+
70
+ /**
71
+ * Returns source desired protocol if supported
72
+ * @param {string} protocol - the desired protocol for the source (base play url protocol)
73
+ * @returns {string} - protocol if protocol is in the protocols list - if not empty string returned
74
+ */
75
+ public getProtocol(protocol: string): string {
76
+ let returnValue: string = '';
77
+ if (this.protocols && this.protocols.length > 0) {
78
+ const protocolsArr: Array<string> = this.protocols.split(',');
79
+ protocolsArr.forEach(p => {
80
+ if (p === protocol) {
81
+ returnValue = p;
82
+ }
83
+ });
84
+ } else if (protocol === 'http') {
85
+ return protocol;
86
+ }
87
+ return returnValue;
88
+ }
89
+ }
@@ -0,0 +1,33 @@
1
+ export class KalturaPlaylist {
2
+ /**
3
+ * @member - playlist id
4
+ * @type {string}
5
+ */
6
+ public id: string;
7
+ /**
8
+ * @member - playlist name
9
+ * @type {string}
10
+ */
11
+ public name: string;
12
+ /**
13
+ * @member - playlist description
14
+ * @type {string}
15
+ */
16
+ public description: string;
17
+ /**
18
+ * @member - playlist poster image
19
+ * @type {string}
20
+ */
21
+ public poster: string;
22
+
23
+ /**
24
+ * @constructor
25
+ * @param {Object} playlist - The json response
26
+ */
27
+ constructor(playlist: any) {
28
+ this.id = playlist.id;
29
+ this.name = playlist.name;
30
+ this.description = playlist.description;
31
+ this.poster = playlist.thumbnailUrl;
32
+ }
33
+ }
@@ -0,0 +1,27 @@
1
+ export class KalturaRuleAction {
2
+ public static Type: {[type: string]: string | number} = {
3
+ DRM_POLICY: 'drm.DRM_POLICY',
4
+ BLOCK: 1,
5
+ PREVIEW: 2,
6
+ LIMIT_FLAVORS: 3,
7
+ ADD_TO_STORAGE: 4,
8
+ LIMIT_DELIVERY_PROFILES: 5,
9
+ SERVE_FROM_REMOTE_SERVER: 6,
10
+ REQUEST_HOST_REGEX: 7,
11
+ LIMIT_THUMBNAIL_CAPTURE: 8
12
+ };
13
+
14
+ /**
15
+ * @member - The type of the action
16
+ * @type {string|number}
17
+ */
18
+ public type: string | number;
19
+
20
+ /**
21
+ * @constructor
22
+ * @param {Object} data - The response
23
+ */
24
+ constructor(data: any) {
25
+ this.type = data.type;
26
+ }
27
+ }