@tivio/sdk-js 2.0.0-alpha2 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +18 -8
- package/dist/api.types.d.ts +12 -7
- package/dist/conf.d.ts +39 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/services/bundleLoader.d.ts +1 -1
- package/dist/services/playerWrapper.d.ts +29 -0
- package/dist/services/playerWrapperInternal.d.ts +28 -0
- package/dist/types.d.ts +2 -1
- package/package.json +3 -1
@@ -18,7 +18,7 @@ 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
|
/**
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { AdMetadata, PlayerInterfaceForPlayerWrapper, PlayerWrapperEventType, Source, TivioPlayerWrapper } from '../api.types';
|
2
|
+
import { InternalPlayerWrapper } from './playerWrapperInternal';
|
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: PlayerWrapperEventType.adMetadata, listener: (metadata: AdMetadata) => void): void;
|
11
|
+
reportError(error: Error): void;
|
12
|
+
reportPlaybackEnded(): void;
|
13
|
+
reportTimeProgress(ms: number): void;
|
14
|
+
seekTo(ms: number): void;
|
15
|
+
setSource(source: Source | null): void;
|
16
|
+
}
|
17
|
+
/**
|
18
|
+
* Called when tivio is initialized (remote bundle is ready).
|
19
|
+
*
|
20
|
+
* @param {CreatePlayerWrapperType} createPlayerWrapperFromCoreJs - functions which creates player wrapper in core-js
|
21
|
+
*/
|
22
|
+
export declare const onCreatePlayerWrapperReady: (createPlayerWrapperFromCoreJs: CreatePlayerWrapperType) => void;
|
23
|
+
/**
|
24
|
+
* Public method accessible in SDK.
|
25
|
+
*
|
26
|
+
* @param {PlayerInterfaceForPlayerWrapper} playerImplementation - player implementation from SDK user
|
27
|
+
* @returns player wrapper instance
|
28
|
+
*/
|
29
|
+
export declare const createPlayerWrapper: (playerImplementation: PlayerInterfaceForPlayerWrapper) => PlayerWrapper;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { AdMetadata, PlayerInterfaceForPlayerWrapper, PlayerWrapperEventType, 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: PlayerWrapperEventType.adMetadata;
|
13
|
+
listener: (metadata: AdMetadata) => void;
|
14
|
+
}[];
|
15
|
+
constructor(playerImplementation: PlayerInterfaceForPlayerWrapper, id: string);
|
16
|
+
addEventListener(eventType: PlayerWrapperEventType.adMetadata, listener: (metadata: AdMetadata) => void): 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.1.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",
|