@tivio/sdk-js 2.0.0-alpha3 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +22 -8
- package/dist/api.types.d.ts +31 -9
- package/dist/conf.d.ts +36 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1 -1
- package/dist/services/bundleLoader.d.ts +2 -1
- package/dist/services/getProgramTimestamps.d.ts +6 -0
- package/dist/services/playerWrapper.d.ts +28 -0
- package/dist/services/playerWrapperInternal.d.ts +28 -0
- package/dist/types.d.ts +2 -1
- package/package.json +3 -1
@@ -18,11 +18,12 @@ export declare type RemoteBundleState = {
|
|
18
18
|
error: string | null;
|
19
19
|
conf: InternalConf;
|
20
20
|
settings: Settings;
|
21
|
-
} & Partial<ExposedApi>;
|
21
|
+
} & Omit<Partial<ExposedApi>, 'createPlayerWrapper'>;
|
22
22
|
export declare type Api = RemoteBundleState;
|
23
23
|
export declare const fetchBundleViaResolver: (conf: InternalConf) => Promise<string>;
|
24
24
|
/**
|
25
25
|
* Fetch & load CommonJS remote module.
|
26
26
|
*/
|
27
27
|
export declare const createRemotePackageLoader: () => (conf: InternalConf) => Promise<TivioBundle>;
|
28
|
+
export declare let tivioBundle: RemoteBundleState | null;
|
28
29
|
export declare const createTivio: () => (conf: Conf) => Promise<RemoteBundleState>;
|
@@ -0,0 +1,28 @@
|
|
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): 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;
|
@@ -0,0 +1,28 @@
|
|
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): 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
|
+
}
|
package/dist/types.d.ts
CHANGED
@@ -6,6 +6,7 @@
|
|
6
6
|
* Export public client side API
|
7
7
|
*/
|
8
8
|
import { InternalConf } from './conf';
|
9
|
-
export
|
9
|
+
export { PlayerCapability } from './conf';
|
10
|
+
export declare type Conf = Pick<InternalConf, 'bundleUrlOverride' | 'capabilitiesOptions' | 'deviceCapabilities' | 'enableSentry' | 'forceCloudFnResolver' | 'language' | 'logger' | 'secret' | 'verbose'>;
|
10
11
|
export declare type Empty = Promise<void> | void;
|
11
12
|
export declare type Disposer = () => void;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@tivio/sdk-js",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.2.0",
|
4
4
|
"main": "dist/index.js",
|
5
5
|
"typings": "dist/index.d.ts",
|
6
6
|
"source": "src/index.ts",
|
@@ -18,6 +18,7 @@
|
|
18
18
|
},
|
19
19
|
"dependencies": {
|
20
20
|
"@sentry/browser": "^6.1.0",
|
21
|
+
"core-js": "^3.21.0",
|
21
22
|
"firebase": "^8.2.3",
|
22
23
|
"mobx": "^6.0.4",
|
23
24
|
"whatwg-fetch": "^3.6.2"
|
@@ -33,6 +34,7 @@
|
|
33
34
|
"dotenv": "^8.2.0",
|
34
35
|
"dotenv-webpack": "^7.0.3",
|
35
36
|
"eslint": "^7.19.0",
|
37
|
+
"fork-ts-checker-webpack-plugin": "^7.0.0",
|
36
38
|
"jest": "^26.6.3",
|
37
39
|
"jest-cli": "^26.6.3",
|
38
40
|
"jest-fetch-mock": "^3.0.3",
|