@tivio/sdk-js 2.3.2 → 2.4.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tivio/sdk-js",
3
- "version": "2.3.2",
3
+ "version": "2.4.0",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "source": "src/index.ts",
@@ -9,42 +9,44 @@
9
9
  "access": "public"
10
10
  },
11
11
  "scripts": {
12
- "build": "cat ./.env.prod > ./.env && yarn run clean && webpack --config=webpack.config.prod.js",
13
- "build:dev": "cat ./.env.dev > ./.env && yarn run clean && webpack --config=webpack.config.dev.js",
14
- "test": "jest --config=./jest.config.js --coverage",
12
+ "build": "yarn clean && webpack",
13
+ "build:dev": "cat ./.env.dev > ./.env && yarn build --config=webpack.config.dev.js && yarn typesRollup",
14
+ "build:prod": "cat ./.env.prod > ./.env && yarn build --config=webpack.config.prod.js && yarn typesRollup",
15
+ "turbo:build:libs:dev": "yarn build:dev",
16
+ "turbo:build:libs:prod": "yarn build:prod",
17
+ "build:ci": "yarn build:prod",
18
+ "test": "yarn jest --config=./jest.config.js",
19
+ "test:ci": "yarn test",
15
20
  "start": "webpack -w",
16
21
  "clean": "rm -rf dist",
17
- "prepublishOnly": "yarn && rm -rf ./dist && yarn run build"
22
+ "prepublishOnly": "yarn && rm -rf ./dist && yarn build:prod",
23
+ "typesRollup": "yarn ts-node ./scripts/typesRollup.ts"
18
24
  },
19
25
  "dependencies": {
20
26
  "@sentry/browser": "^6.1.0",
27
+ "@tivio/common": "*",
28
+ "@tivio/core-js": "*",
21
29
  "core-js": "^3.21.0",
22
- "firebase": "^8.2.3",
23
30
  "mobx": "^6.0.4",
24
31
  "whatwg-fetch": "^3.6.2"
25
32
  },
26
33
  "devDependencies": {
27
- "@tivio/common": "*",
28
- "@types/jest": "^26.0.23",
34
+ "@microsoft/api-extractor": "^7.39.1",
35
+ "@tivio/build-utils": "*",
36
+ "@tivio/types": "*",
37
+ "@types/jest": "^29.5.12",
29
38
  "@types/node": "^14.14.21",
30
39
  "@types/node-fetch": "^2.5.8",
31
- "@typescript-eslint/eslint-plugin": "^4.14.0",
32
- "@typescript-eslint/parser": "^4.14.2",
40
+ "@typescript-eslint/eslint-plugin": "^5.30.5",
41
+ "@typescript-eslint/parser": "^5.30.5",
33
42
  "check-es5-webpack-plugin": "^1.0.13",
34
- "dotenv": "^8.2.0",
43
+ "dotenv": "^9.0.0",
35
44
  "dotenv-webpack": "^7.0.3",
36
- "eslint": "^7.19.0",
37
45
  "fork-ts-checker-webpack-plugin": "^7.0.0",
38
- "jest": "^26.6.3",
39
- "jest-cli": "^26.6.3",
46
+ "jest": "^29.7.0",
47
+ "jest-cli": "^29.7.0",
40
48
  "jest-fetch-mock": "^3.0.3",
41
- "node-fetch": "^2.6.1",
42
- "stream-browserify": "^3.0.0",
43
- "timers-browserify": "^2.0.12",
44
- "ts-jest": "^26.4.4",
45
- "typescript": "^4.0.2",
46
- "webpack": "^5.15.0",
47
- "webpack-cli": "^4.4.0",
48
- "webpack-merge": "^5.7.3"
49
+ "ts-jest": "^29.1.4",
50
+ "typescript": "^5"
49
51
  }
50
52
  }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Script for rollup all types into one file.
3
+ */
4
+ import path from 'path'
5
+
6
+ import { Extractor, ExtractorConfig } from '@microsoft/api-extractor'
7
+ import { execCommand } from '@tivio/build-utils'
8
+
9
+
10
+ const apiExtractorJsonPath: string = path.join(__dirname, '../api-extractor.json')
11
+ const extractorConfig = ExtractorConfig.loadFileAndPrepare(apiExtractorJsonPath)
12
+
13
+ // Invoke API Extractor
14
+ const extractorResult = Extractor.invoke(extractorConfig, {
15
+ localBuild: true,
16
+ showVerboseMessages: false,
17
+ })
18
+
19
+ if (extractorResult.succeeded) {
20
+ // Delete original .d.ts files after successful rollup
21
+ execCommand('rm -rf ./dist/distTypes')
22
+ console.log('API Extractor completed successfully')
23
+ process.exitCode = 0
24
+ } else {
25
+ console.error(`API Extractor completed with ${extractorResult.errorCount} errors`
26
+ + ` and ${extractorResult.warningCount} warnings`)
27
+ process.exitCode = 1
28
+ }
@@ -1,303 +0,0 @@
1
- import type { Video, SubscribeToScreen, SubscribeToItemsInRow } from '@tivio/common';
2
- declare type Language = 'cs' | 'en' | 'sk' | 'de' | 'pl';
3
- declare type Widget = {
4
- channels: Channel[];
5
- isEnabled: boolean | null;
6
- name: string | null;
7
- recentVideos: Video[] | null;
8
- widgetId: string | null;
9
- };
10
- declare type Channel = {
11
- name: string;
12
- header: string;
13
- headerLogo: string;
14
- recentVideos: Video[];
15
- };
16
- declare type Section = {
17
- name: string;
18
- channel: Channel;
19
- videos: Video[];
20
- };
21
- declare type Player = {
22
- ad: any;
23
- currentTime: any;
24
- adSegment: any;
25
- event: any;
26
- events: any;
27
- source: any;
28
- state: any;
29
- onPlaybackEnded: any;
30
- onSourceChanged: any;
31
- onStateChanged: any;
32
- onTimeChanged: any;
33
- pause: any;
34
- play: any;
35
- togglePlayPause: any;
36
- register: any;
37
- seekTo: any;
38
- setVolume: any;
39
- triggerEvent: any;
40
- };
41
- declare type SourceBase = {
42
- /**
43
- * Tivio SDK users may use pretty complicated source objects in their existing code and if Tivio player
44
- * is an interception layer, it should allow them to pass through any type of object.
45
- */
46
- additionalPayload?: Record<string, any>;
47
- /**
48
- * Source type.
49
- */
50
- type: 'ad' | 'live_tv_channel' | 'other' | 'tivio_vod' | 'tv_program';
51
- /**
52
- * URI to play.
53
- */
54
- uri: string;
55
- };
56
- declare type StartAndContinuePosition = {
57
- /**
58
- * Relative from stream start, in ms.
59
- * Should be always provided except continueFromPosition is present.
60
- * Tivio can correct this value to the real program start position.
61
- */
62
- startFromPosition?: number;
63
- /**
64
- * Relative from stream start, in ms.
65
- * If provided, tivio will not correct it and will send this value back in startFromPosition.
66
- * If provided, startFromPosition is ignored.
67
- */
68
- continueFromPosition?: number;
69
- };
70
- declare type TvProgramSource = SourceBase & StartAndContinuePosition & {
71
- type: 'tv_program';
72
- /**
73
- * If epgTo is wrong, Tivio cannot correctly guess if the video it startover or timeshift . For such cases
74
- * Tivio needs explicit tv mode.
75
- * null if source begins in the future.
76
- */
77
- tvMode: 'startover' | 'timeshift' | null;
78
- /**
79
- * Tivio needs channel name in order to load markers.
80
- */
81
- channelName: string;
82
- /**
83
- * Tivio needs EPG from in order to load markers.
84
- */
85
- epgFrom: Date;
86
- /**
87
- * Tivio needs EPG to in order to load markers.
88
- */
89
- epgTo: Date;
90
- /**
91
- * When the stream (provided in uri) really starts - typically few minutes before epgFrom.
92
- */
93
- streamStart: Date;
94
- };
95
- declare type TivioVodSource = SourceBase & StartAndContinuePosition & {
96
- type: 'tivio_vod';
97
- /**
98
- * Allows Tivio to load monetization config an apply ads.
99
- */
100
- videoPath: string;
101
- };
102
- declare type AdSource = SourceBase & {
103
- type: 'ad';
104
- };
105
- /**
106
- * If Tivio PlayerWrapper is an interception layer, it should allow the pass-through
107
- * of not just Tivio source types but any other source types that the 3rd party app may be using.
108
- */
109
- declare type OtherSource = SourceBase & StartAndContinuePosition & {
110
- type: 'other';
111
- };
112
- /**
113
- * Not supported yet, now it does pass-through only.
114
- */
115
- declare type LiveTvChannelSource = SourceBase & StartAndContinuePosition & {
116
- type: 'live_tv_channel';
117
- /**
118
- * Tivio needs channel name in order to load markers.
119
- */
120
- channelName: string;
121
- };
122
- declare type Source = TvProgramSource | TivioVodSource | AdSource | OtherSource | LiveTvChannelSource;
123
- declare type AdMetadata = {
124
- type: 'ad';
125
- subType: 'inserted' | 'original';
126
- secondsToEnd: number;
127
- /**
128
- * null when ad is not skippable
129
- */
130
- secondsToSkippable: number | null;
131
- canTriggerSkip: boolean;
132
- isSkippable: boolean;
133
- order: number | null;
134
- totalCount: number | null;
135
- skip: () => void;
136
- } | null;
137
- interface Marker {
138
- id: string;
139
- from: Date;
140
- to: Date;
141
- relativeFromMs: number;
142
- relativeToMs: number;
143
- type: 'AD' | 'AD_SEGMENT' | 'START' | 'END' | 'INTRO';
144
- }
145
- declare enum PlayerWrapperEventType {
146
- adMetadata = "adMetadata",
147
- markers = "markers"
148
- }
149
- declare type PlayerWrapperEventTypeType = `${PlayerWrapperEventType}`;
150
- declare type ListenerAdMetadata = (metadata: AdMetadata) => void;
151
- declare type ListenerMarkers = (marker: Marker[] | null) => void;
152
- declare type Listener = ListenerAdMetadata | ListenerMarkers;
153
- interface TivioPlayerWrapper {
154
- addEventListener: (eventType: PlayerWrapperEventTypeType, listener: Listener) => void;
155
- reportError: (error: Error) => void;
156
- reportPlaybackEnded: () => void;
157
- reportTimeProgress: (ms: number) => void;
158
- seekTo: (ms: number) => void;
159
- /**
160
- * @param {Source} source - source to set
161
- * @param {string} calibrationId - id of calibration profile
162
- */
163
- setSource: (source: Source | null, calibrationId?: string) => void;
164
- }
165
- interface PlayerInterfaceForPlayerWrapper {
166
- /**
167
- * @param {number} ms - milliseconds relative to start of video (relative to 0 ms)
168
- * or in case of TV programs relative to start of the program (relative to source.from ms)
169
- */
170
- seekTo: (ms: number) => void;
171
- setSource: (source: Source | null) => void;
172
- }
173
- declare type ExposedApi = {
174
- AdSource: any;
175
- ChannelSource: any;
176
- VodTivioSource: any;
177
- /**
178
- * Get channel by its id.
179
- * @param channelId - channel id
180
- * @returns {Promise<Channel | null>} channel or null if channel does not exists
181
- */
182
- getChannelById: (channelId: string) => Promise<Channel | null>;
183
- /**
184
- * Get (or create) player wrapper instance
185
- * @param id - player wrapper id
186
- * @returns {Player} player wrapper instance
187
- */
188
- getPlayer: (id: string) => Player;
189
- /**
190
- * Get section by its id.
191
- * @param sectionId - section id
192
- * @returns {Promise<{section: Section, channel: Channel} | null>} section and channel or null if channel or section does not exists
193
- */
194
- getSectionById: (sectionId: string) => Promise<Section | null>;
195
- /**
196
- * Get video by its id.
197
- * @param videoId - video id
198
- * @returns {Promise<Video | null>} video or null if video does not exists
199
- */
200
- getVideoById: (videoId: string) => Promise<Video | null>;
201
- /**
202
- * Get widget by its id.
203
- * @param widgetId - widget id
204
- * @returns {Promise<Widget | null>} widget or null if widget does not exists
205
- */
206
- getWidgetById: (widgetId: string) => Promise<Widget | null>;
207
- /**
208
- * Set tivio language.
209
- * @param language
210
- */
211
- setLanguage: (language: Language) => void;
212
- /**
213
- * Set user.
214
- * @param userId
215
- * @param payload
216
- * @param additionalUserData
217
- */
218
- setUser: (userId: string, payload: unknown, additionalUserData?: unknown) => Promise<void>;
219
- /**
220
- * Listen to widget changes.
221
- * @param widgetId - widget id
222
- * @param cb - callback on widget updates or on error
223
- */
224
- subscribeToWidget: (widgetId: string, cb: (error: Error | null, data: Widget | null) => void) => void;
225
- /**
226
- * Listen to channel changes.
227
- * @param channelId - channel id
228
- * @param cb - callback on channel updates or on error
229
- */
230
- subscribeToChannel: (channelId: string, cb: (error: Error | null, data: Channel | null) => void) => void;
231
- /**
232
- * Listen to section changes.
233
- * @param sectionId - section id
234
- * @param cb - callback on section updates or on error
235
- */
236
- subscribeToSection: (sectionId: string, cb: (error: Error | null, data: Section | null) => void) => void;
237
- /**
238
- * Listen to video changes.
239
- * @param videoId - video id
240
- * @param cb - callback on video updates or on error
241
- */
242
- subscribeToVideo: (videoId: string, cb: (error: Error | null, data: Video | null) => void) => void;
243
- /**
244
- * Listen to videos in section changes.
245
- * @param channelId - channel id
246
- * @param sectionId - section id
247
- * @param cb - callback on videos change or error
248
- * @param limit - videos count
249
- */
250
- subscribeToVideosInSection: (sectionId: string, cb: (error: null | Error, data: null | {
251
- videos: Video[];
252
- hasNextPage: boolean;
253
- }, fetchMore: null | ((count?: number) => void)) => void, limit?: number) => void;
254
- /**
255
- * Listen to section in channel changes
256
- * @param channelId - channel id
257
- * @param cb - callback on sections change or error
258
- * @param limit - sections count
259
- */
260
- subscribeToSectionsInChannel: (channelId: string, cb: (error: null | Error, data: null | {
261
- sections: Section[];
262
- hasNextPage: boolean;
263
- }, fetchMore: null | ((count?: number) => void)) => void, limit?: number) => void;
264
- /**
265
- * Listen to channels in widget changes
266
- * @param widgetId - widget id
267
- * @param cb - callback on channels change or error
268
- * @param limit - channels count
269
- */
270
- subscribeToChannelsInWidget: (widgetId: string, cb: (error: null | Error, data: null | {
271
- channels: Channel[];
272
- hasNextPage: boolean;
273
- }, fetchMore: null | ((count?: number) => void)) => void, limit?: number) => void;
274
- /**
275
- * @param screenId - screen id
276
- * @param cb - callback on screen or error
277
- * @param options - additional options
278
- */
279
- subscribeToScreen: SubscribeToScreen;
280
- /**
281
- * @param rowId - screen id
282
- * @param cb - callback on items or error
283
- * @param options - additional options
284
- */
285
- subscribeToItemsInRow: SubscribeToItemsInRow;
286
- /**
287
- * @param email
288
- * @param password
289
- */
290
- createUserWithEmailAndPassword: (email: string, password: string) => Promise<void>;
291
- /**
292
- * Sign in the user and starts listening on his purchases
293
- * @param email
294
- * @param password
295
- */
296
- signInWithEmailAndPassword: (email: string, password: string) => Promise<void>;
297
- createPlayerWrapper: (playerImplementation: PlayerInterfaceForPlayerWrapper) => TivioPlayerWrapper;
298
- getProgramTimestamps: (channelName: string, epgFrom: Date, epgTo: Date) => Promise<{
299
- startTimestamp?: number;
300
- endTimestamp?: number;
301
- } | null>;
302
- };
303
- export { AdMetadata, AdSource, ExposedApi, LiveTvChannelSource, OtherSource, PlayerInterfaceForPlayerWrapper, PlayerWrapperEventType, PlayerWrapperEventTypeType, Source, TivioPlayerWrapper, TivioVodSource, TvProgramSource, Marker, ListenerAdMetadata, ListenerMarkers, Listener, };
package/dist/conf.d.ts DELETED
@@ -1,59 +0,0 @@
1
- /**
2
- * Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
3
- * nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4
- */
5
- import { Logger } from './services/logger';
6
- import { FetchPackage } from './services/packageLoader';
7
- import { Conf as ExternalConf } from './types';
8
- export interface PlayerCapability {
9
- codec: 'h264' | 'h265';
10
- encryption: 'fairplay' | 'none' | 'playready' | 'widevine';
11
- protocol: 'dash' | 'hls';
12
- }
13
- export declare type InternalConf = {
14
- /**
15
- * @private URL of remote code bundle to be fetched directly (without using resolver)
16
- */
17
- bundleUrlOverride?: string;
18
- /**
19
- * Tells Tivio which technologies/protocols etc. is the device capable to play.
20
- * If not provided, Tivio will try to guess it (based on the browser).
21
- */
22
- deviceCapabilities?: PlayerCapability[];
23
- /**
24
- * Additional options for deviceCapabilities
25
- */
26
- capabilitiesOptions?: {
27
- /**
28
- * Should the player prefer HTTP sources instead HTTPs if they are available.
29
- * This can be used on platforms that support mixed content but do not support
30
- * specific HTTPS certificates. (e.g. certificates from Letsencrypt not supported on LG TVs)
31
- */
32
- preferHttp?: boolean;
33
- };
34
- secret: string;
35
- resolverUrl: string;
36
- logger?: Logger | null;
37
- fetchPackage: FetchPackage;
38
- language?: string;
39
- sdkVersion: string;
40
- /**
41
- * Can force using bundle resolver method which doesn't depend on indexedDB (useful when some polyfill
42
- * for indexedDB is used but indexedDB is not fully supported - it leads to situation where check for indexedDB
43
- * presence passes but resolver fails anyway).
44
- */
45
- forceCloudFnResolver?: boolean;
46
- /**
47
- * Can turn off Tivio's Sentry logging, defaults to true.
48
- */
49
- enableSentry?: boolean;
50
- /**
51
- * Can turn on Tivio's console logging, defaults to false.
52
- */
53
- verbose?: boolean;
54
- };
55
- export declare const defaultConf: {
56
- resolverUrl: string;
57
- fetchPackage: FetchPackage;
58
- };
59
- export declare const createInternalConf: (conf: ExternalConf) => InternalConf;
@@ -1 +0,0 @@
1
- import './setupTests';
@@ -1,36 +0,0 @@
1
- import type { Empty } from './types';
2
- interface BasicSource {
3
- description: string;
4
- name: string;
5
- uri: string;
6
- type: 'AD' | 'VOD' | 'CHANNEL';
7
- }
8
- interface ChannelSource extends BasicSource {
9
- from: Date;
10
- channelName: string;
11
- to: Date;
12
- type: 'CHANNEL';
13
- }
14
- interface AdSource extends BasicSource {
15
- durationMs: number;
16
- skipDelayMs: number | null;
17
- type: 'AD';
18
- }
19
- interface VodSource extends BasicSource {
20
- type: 'VOD';
21
- }
22
- export declare type InputSource = AdSource | ChannelSource | VodSource;
23
- export declare type PlayerInterface = {
24
- play: () => Empty;
25
- pause: () => Empty;
26
- seekTo: (positionMs: number) => Empty;
27
- setSource: (source: InputSource | null) => Empty;
28
- setVolume: (volume: number) => Empty;
29
- };
30
- export declare type PlayerWrapper = {
31
- events: {
32
- addListener: <T = any>(event: string, cb: (value: T) => Empty) => Empty;
33
- removeAllListeners: () => Empty;
34
- };
35
- };
36
- export {};
@@ -1,29 +0,0 @@
1
- /**
2
- * Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
3
- * nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4
- */
5
- import { InternalConf } from '../conf';
6
- import { Conf } from '../types';
7
- import { Settings } from './settings';
8
- import type { ExposedApi } from '../api.types';
9
- export declare type RemoteProviderProps = {
10
- language?: string;
11
- };
12
- export declare type TivioBundle = {
13
- init: (config: Conf) => void | Promise<void>;
14
- setUser: (userId: string, payload: unknown, additionalUserData?: unknown) => void;
15
- } & ExposedApi;
16
- export declare type RemoteBundleState = {
17
- state: 'loading' | 'error' | 'ready';
18
- error: string | null;
19
- conf: InternalConf;
20
- settings: Settings;
21
- } & Omit<Partial<ExposedApi>, 'createPlayerWrapper'>;
22
- export declare type Api = RemoteBundleState;
23
- export declare const fetchBundleViaResolver: (conf: InternalConf) => Promise<string>;
24
- /**
25
- * Fetch & load CommonJS remote module.
26
- */
27
- export declare const createRemotePackageLoader: () => (conf: InternalConf) => Promise<TivioBundle>;
28
- export declare let tivioBundle: RemoteBundleState | null;
29
- export declare const createTivio: () => (conf: Conf) => Promise<RemoteBundleState>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,12 +0,0 @@
1
- /**
2
- * Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
3
- * nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4
- */
5
- /// <reference types="node" />
6
- import firebase from 'firebase/app';
7
- import 'firebase/auth';
8
- import 'firebase/firestore';
9
- import * as mobx from 'mobx';
10
- import * as timers from 'timers';
11
- export declare type SharedDependency = typeof mobx | typeof firebase | typeof timers | null;
12
- export declare const resolveShared: (name: string) => SharedDependency;
@@ -1 +0,0 @@
1
- import '../setupTests';
@@ -1,6 +0,0 @@
1
- declare type Result = Promise<{
2
- startTimestamp?: number;
3
- endTimestamp?: number;
4
- } | null>;
5
- export declare const getProgramTimestamps: (channelName: string, epgFrom: Date, epgTo: Date) => Result;
6
- export {};
@@ -1,28 +0,0 @@
1
- /**
2
- * Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
3
- * nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4
- */
5
- export declare type LoggerArgs = any[];
6
- export interface Logger {
7
- /** important messages */
8
- warn(...data: LoggerArgs): void;
9
- /** errors */
10
- error(...data: LoggerArgs): void;
11
- /** critical errors */
12
- exception(...data: LoggerArgs): void;
13
- /** metrics */
14
- info(...data: LoggerArgs): void;
15
- /** non-production messages */
16
- debug(...data: LoggerArgs): void;
17
- }
18
- export declare type LoggerConf = {
19
- isConsoleEnabled: boolean;
20
- isSentryEnabled?: boolean;
21
- };
22
- declare type LogLevel = 'warn' | 'error' | 'info' | 'debug';
23
- export declare type Severity = LogLevel | 'exception';
24
- /**
25
- * Factory
26
- **/
27
- export declare const createLogger: (conf: LoggerConf) => Logger;
28
- export {};
@@ -1 +0,0 @@
1
- import '../setupTests';
@@ -1,6 +0,0 @@
1
- /**
2
- * Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
3
- * nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4
- */
5
- export declare type FetchPackage = (url: string) => Promise<string>;
6
- export declare const fetchPackage: FetchPackage;
@@ -1 +0,0 @@
1
- export {};
@@ -1,28 +0,0 @@
1
- import { InternalPlayerWrapper } from './playerWrapperInternal';
2
- import type { ListenerAdMetadata, ListenerMarkers, PlayerInterfaceForPlayerWrapper, Source, TivioPlayerWrapper } from '../api.types';
3
- import type { CreatePlayerWrapperType } from './playerWrapperInternal';
4
- /**
5
- * Player wrapper which instances are exposed to SDK user.
6
- */
7
- export declare class PlayerWrapper implements TivioPlayerWrapper {
8
- private internalPlayerWrapper;
9
- constructor(internalPlayerWrapper: InternalPlayerWrapper);
10
- addEventListener(eventType: 'adMetadata', listener: ListenerAdMetadata): void;
11
- addEventListener(eventType: 'markers', listener: ListenerMarkers): void;
12
- reportError(error: Error): void;
13
- reportPlaybackEnded(): void;
14
- reportTimeProgress(ms: number): void;
15
- seekTo(ms: number): void;
16
- setSource(source: Source | null, calibrationId?: string): void;
17
- }
18
- /**
19
- * Called when tivio is initialized (remote bundle is ready).
20
- *
21
- * @param {CreatePlayerWrapperType} createPlayerWrapperFromCoreJs - functions which creates player wrapper in core-js
22
- */
23
- export declare const onCreatePlayerWrapperReady: (createPlayerWrapperFromCoreJs: CreatePlayerWrapperType) => void;
24
- /**
25
- * @param {PlayerInterfaceForPlayerWrapper} playerImplementation - player implementation
26
- * @returns player wrapper instance
27
- */
28
- export declare const createPlayerWrapper: (playerImplementation: PlayerInterfaceForPlayerWrapper) => PlayerWrapper;
@@ -1,28 +0,0 @@
1
- import type { Listener, PlayerInterfaceForPlayerWrapper, PlayerWrapperEventTypeType, Source, TivioPlayerWrapper } from '../api.types';
2
- export declare type CreatePlayerWrapperType = (playerImplementation: PlayerInterfaceForPlayerWrapper) => TivioPlayerWrapper;
3
- /**
4
- * Responsible for handling of all player wrapper methods (it's called through PlayerWrapper).
5
- * Also handles state when player wrapper from core-js is not ready yet and situation when it becomes ready.
6
- */
7
- export declare class InternalPlayerWrapper implements TivioPlayerWrapper {
8
- private playerImplementation;
9
- private id;
10
- corePlayerWrapperInstance: TivioPlayerWrapper | null;
11
- listenersWaitingToRegister: {
12
- eventType: PlayerWrapperEventTypeType;
13
- listener: Listener;
14
- }[];
15
- constructor(playerImplementation: PlayerInterfaceForPlayerWrapper, id: string);
16
- addEventListener(eventType: PlayerWrapperEventTypeType, listener: Listener): void;
17
- reportError(error: Error): void;
18
- reportPlaybackEnded(): void;
19
- reportTimeProgress(ms: number): void;
20
- seekTo(ms: number): void;
21
- setSource(source: Source | null, calibrationId?: string): void;
22
- /**
23
- * Set instance of the real player wrapper (from core-js).
24
- *
25
- * @param createPlayerWrapper - create player wrapper method from core-js
26
- */
27
- onPlayerWrapperReady(createPlayerWrapper: CreatePlayerWrapperType): void;
28
- }