@tivio/sdk-js 2.0.0-alpha2 → 2.1.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/README.md CHANGED
@@ -12,14 +12,24 @@ yarn add @tivio/sdk-js
12
12
 
13
13
  # Changelog
14
14
 
15
- * 2.0.0-alpha2
16
- * add fetch polyfill
17
- * requires core-js at least 1.12.0
18
- * force using cloud fn instead of resolver
19
- * major: rename positionMs to startFromPosition
20
- * minor: add streamStart to TvProgramSource
21
- * minor: add continueFromPosition to TvProgramSource, TivioVodSource, OtherSource and LiveTvChannelSource
22
- * minor: live_tv_channel source type does pass-through instead of stopping the setSource action
15
+ * 2.1.0
16
+ * minor: better es5 polyfills
17
+ * patch: add `verbose` to Tivio config type
18
+ * patch: add `bundleUrlOverride` to Tivio config type
19
+ * patch: fix of registering player wrapper when `createPlayerWrapper` is called after tivio init
20
+ * 2.0.0
21
+ * requires core-js at least 1.13.0
22
+ * major: remove `createPlayerWrapper` from Tivio API object
23
+ * major: rename `positionMs` to `startFromPosition`
24
+ * minor: add `createPlayerWrapper` to the root of the @tivio-sdk-js package, it's not necessary to wait until
25
+ `createTivio` is finished before using it but it is still necessary to call `createTivio` at some point
26
+ * minor: add (optional) `capabilitiesOptions` and `deviceCapabilities` options to Tivio config
27
+ * minor: add fetch polyfill
28
+ * minor: better source types documentation
29
+ * minor: add `streamStart` to `TvProgramSource`
30
+ * minor: add `continueFromPosition` to `TvProgramSource`, `TivioVodSource`, `OtherSource` and `LiveTvChannelSource`
31
+ * minor: `live_tv_channel` source type does pass-through instead of stopping the `setSource` action
32
+ * minor: add `forceCloudFnResolver` option to Tivio config
23
33
  * 1.1.0
24
34
  * minor: fallback to fetch bundle by cloud fn when indexedDB not supported
25
35
  * minor: transpile to es5
@@ -137,14 +137,22 @@ declare type AdMetadata = {
137
137
  declare enum PlayerWrapperEventType {
138
138
  adMetadata = "adMetadata"
139
139
  }
140
- declare type TivioPlayerWrapper = {
140
+ interface TivioPlayerWrapper {
141
141
  addEventListener: (eventType: PlayerWrapperEventType.adMetadata, listener: (metadata: AdMetadata) => void) => void;
142
142
  reportError: (error: Error) => void;
143
143
  reportPlaybackEnded: () => void;
144
144
  reportTimeProgress: (ms: number) => void;
145
145
  seekTo: (ms: number) => void;
146
146
  setSource: (source: Source | null) => void;
147
- };
147
+ }
148
+ interface PlayerInterfaceForPlayerWrapper {
149
+ /**
150
+ * @param {number} ms - milliseconds relative to start of video (relative to 0 ms)
151
+ * or in case of TV programs relative to start of the program (relative to source.from ms)
152
+ */
153
+ seekTo: (ms: number) => void;
154
+ setSource: (source: Source | null) => void;
155
+ }
148
156
  declare type ExposedApi = {
149
157
  AdSource: any;
150
158
  ChannelSource: any;
@@ -269,9 +277,6 @@ declare type ExposedApi = {
269
277
  * @param password
270
278
  */
271
279
  signInWithEmailAndPassword: (email: string, password: string) => Promise<void>;
272
- createPlayerWrapper: (playerImplementation: {
273
- setSource: (source: Source | null) => void;
274
- seekTo: (ms: number) => void;
275
- }) => TivioPlayerWrapper;
280
+ createPlayerWrapper: (playerImplementation: PlayerInterfaceForPlayerWrapper) => TivioPlayerWrapper;
276
281
  };
277
- export { AdMetadata, AdSource, ExposedApi, LiveTvChannelSource, OtherSource, PlayerWrapperEventType, Source, TivioPlayerWrapper, TivioVodSource, TvProgramSource, };
282
+ export { AdMetadata, AdSource, ExposedApi, LiveTvChannelSource, OtherSource, PlayerInterfaceForPlayerWrapper, PlayerWrapperEventType, Source, TivioPlayerWrapper, TivioVodSource, TvProgramSource, };
package/dist/conf.d.ts CHANGED
@@ -5,13 +5,52 @@
5
5
  import { Logger } from './services/logger';
6
6
  import { FetchPackage } from './services/packageLoader';
7
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
+ }
8
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
+ };
9
34
  secret: string;
10
35
  resolverUrl: string;
11
36
  logger?: Logger | null;
12
37
  fetchPackage: FetchPackage;
13
38
  language?: string;
14
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;
15
54
  };
16
55
  export declare const defaultConf: {
17
56
  resolverUrl: string;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import 'whatwg-fetch';
2
+ import 'core-js/actual';
2
3
  export * from './services/bundleLoader';
3
4
  export * from './types';
4
5
  export * from './api.types';
6
+ export { createPlayerWrapper } from './services/playerWrapper';