@tivio/sdk-react 9.3.0 → 9.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/README.md CHANGED
@@ -182,13 +182,13 @@ await user.createUserProfile({
182
182
 
183
183
  ```typescript
184
184
  user.setActiveUserProfileId(profileId: string): void
185
+ ```
185
186
 
186
187
  #### Delete user profile
187
188
 
188
189
  ```typescript
189
190
  user.deleteUserProfile(profileId: string): Promise<void>
190
191
  ```
191
- ```
192
192
 
193
193
  ## Content
194
194
 
@@ -237,7 +237,7 @@ getFavorites(options?: GetUserProfileDataOptions): Promise<FavoriteWithData[]>
237
237
  ```
238
238
  **Example**
239
239
  ```typescript
240
- const favorites = await tivio.getFavorites()
240
+ const favorites = await user.getFavorites()
241
241
  favorites.forEach(favorite => {
242
242
  console.log({
243
243
  name: favorite.name,
@@ -263,7 +263,7 @@ getWatchPositions(options?: GetUserProfileDataOptions): Promise<WatchPositionWit
263
263
  ```
264
264
  **Example**
265
265
  ```typescript
266
- const watchPositions = await tivio.getWatchPositions()
266
+ const watchPositions = await user.getWatchPositions()
267
267
  watchPositions.forEach(watchPosition => {
268
268
  console.log({
269
269
  position: watchPosition.position, // watch position in milliseconds
@@ -284,7 +284,7 @@ getWatchHistory(options?: GetUserProfileDataOptions): Promise<WatchPositionWithD
284
284
  ```
285
285
  **Example**
286
286
  ```typescript
287
- const watchHistory = await tivio.getWatchHistory()
287
+ const watchHistory = await user.getWatchHistory()
288
288
  watchHistory.forEach(watchPosition => {
289
289
  console.log({
290
290
  position: watchPosition.position, // watch position in milliseconds
@@ -302,7 +302,7 @@ watchHistory.forEach(watchPosition => {
302
302
 
303
303
  Simply call addToFavorites or removeFromFavorites on the Video or Tag.
304
304
  ```typescript
305
- const video = await tivio.getVideoById('videoId')
305
+ const video = await tivio.getVideoById('videoId')
306
306
  await video.addToFavorites()
307
307
  await video.removeFromFavorites()
308
308
 
@@ -585,7 +585,7 @@ The Tivio player supports different types of sources:
585
585
  **VOD_EXTERNAL** - External video-on-demand content from third-party URLs
586
586
  - Used for playing videos that are hosted outside of Tivio's infrastructure
587
587
  - Supports various streaming protocols (HLS, DASH, MP4)
588
- - Example usage:
588
+ - Example usage (single url):
589
589
  ```typescript
590
590
  const externalSource = {
591
591
  type: SourceType.VOD_EXTERNAL,
@@ -597,6 +597,26 @@ const externalSource = {
597
597
  continuePositionMs: 10000, // Start at 10 seconds (optional)
598
598
  }
599
599
  ```
600
+ - It is also possible to set multiple urls for external source type, e.g. when you want to use both DASH and HLS formats. Player then automatically will pick most suitable format to play depending on device capabilities.
601
+ - Example usage (multiple urls):
602
+ ```typescript
603
+ const externalSource = {
604
+ type: SourceType.VOD_EXTERNAL,
605
+ urls: ['https://example.com/video.m3u8', 'https://example.com/video.mpd'],
606
+ sourcePlayMode: SourcePlayMode.ON_DEMAND,
607
+ }
608
+ ```
609
+
610
+ **VOD_TIVIO** - Internal source type for playing content managed by Tivio
611
+ - Used for playing videos and tv channels managed by Tivio infrastructure, e.g. everything that is uploaded through Tivio Admin application
612
+ - For convenience, it is recommended to use shortcut format and pass the source as string in `${'videos' | 'tvChannels'}/{id}` format
613
+ - Ids of corresponding videos and tv channel could be found in Tivio admin application
614
+ - Example usage:
615
+ ```typescript
616
+ const tivioVideoSource = 'videos/2BzH4xsTXW8vqYKJegXj'
617
+ const tivioTvChannelSource = 'tvChannels/Ct4UcK6ozX3VfxaL5yP5'
618
+ ```
619
+ - Otherwise, it is also possible to pass internal tivio source as an object with `type: SourceType.VOD_TIVIO` and additional parameters, similarly to external source type.
600
620
 
601
621
  #### Source Play Modes
602
622
 
package/README.md.bak CHANGED
@@ -182,13 +182,13 @@ await user.createUserProfile({
182
182
 
183
183
  ```typescript
184
184
  user.setActiveUserProfileId(profileId: string): void
185
+ ```
185
186
 
186
187
  #### Delete user profile
187
188
 
188
189
  ```typescript
189
190
  user.deleteUserProfile(profileId: string): Promise<void>
190
191
  ```
191
- ```
192
192
 
193
193
  ## Content
194
194
 
@@ -237,7 +237,7 @@ getFavorites(options?: GetUserProfileDataOptions): Promise<FavoriteWithData[]>
237
237
  ```
238
238
  **Example**
239
239
  ```typescript
240
- const favorites = await tivio.getFavorites()
240
+ const favorites = await user.getFavorites()
241
241
  favorites.forEach(favorite => {
242
242
  console.log({
243
243
  name: favorite.name,
@@ -263,7 +263,7 @@ getWatchPositions(options?: GetUserProfileDataOptions): Promise<WatchPositionWit
263
263
  ```
264
264
  **Example**
265
265
  ```typescript
266
- const watchPositions = await tivio.getWatchPositions()
266
+ const watchPositions = await user.getWatchPositions()
267
267
  watchPositions.forEach(watchPosition => {
268
268
  console.log({
269
269
  position: watchPosition.position, // watch position in milliseconds
@@ -284,7 +284,7 @@ getWatchHistory(options?: GetUserProfileDataOptions): Promise<WatchPositionWithD
284
284
  ```
285
285
  **Example**
286
286
  ```typescript
287
- const watchHistory = await tivio.getWatchHistory()
287
+ const watchHistory = await user.getWatchHistory()
288
288
  watchHistory.forEach(watchPosition => {
289
289
  console.log({
290
290
  position: watchPosition.position, // watch position in milliseconds
@@ -302,7 +302,7 @@ watchHistory.forEach(watchPosition => {
302
302
 
303
303
  Simply call addToFavorites or removeFromFavorites on the Video or Tag.
304
304
  ```typescript
305
- const video = await tivio.getVideoById('videoId')
305
+ const video = await tivio.getVideoById('videoId')
306
306
  await video.addToFavorites()
307
307
  await video.removeFromFavorites()
308
308
 
@@ -585,7 +585,7 @@ The Tivio player supports different types of sources:
585
585
  **VOD_EXTERNAL** - External video-on-demand content from third-party URLs
586
586
  - Used for playing videos that are hosted outside of Tivio's infrastructure
587
587
  - Supports various streaming protocols (HLS, DASH, MP4)
588
- - Example usage:
588
+ - Example usage (single url):
589
589
  ```typescript
590
590
  const externalSource = {
591
591
  type: SourceType.VOD_EXTERNAL,
@@ -597,6 +597,26 @@ const externalSource = {
597
597
  continuePositionMs: 10000, // Start at 10 seconds (optional)
598
598
  }
599
599
  ```
600
+ - It is also possible to set multiple urls for external source type, e.g. when you want to use both DASH and HLS formats. Player then automatically will pick most suitable format to play depending on device capabilities.
601
+ - Example usage (multiple urls):
602
+ ```typescript
603
+ const externalSource = {
604
+ type: SourceType.VOD_EXTERNAL,
605
+ urls: ['https://example.com/video.m3u8', 'https://example.com/video.mpd'],
606
+ sourcePlayMode: SourcePlayMode.ON_DEMAND,
607
+ }
608
+ ```
609
+
610
+ **VOD_TIVIO** - Internal source type for playing content managed by Tivio
611
+ - Used for playing videos and tv channels managed by Tivio infrastructure, e.g. everything that is uploaded through Tivio Admin application
612
+ - For convenience, it is recommended to use shortcut format and pass the source as string in `${'videos' | 'tvChannels'}/{id}` format
613
+ - Ids of corresponding videos and tv channel could be found in Tivio admin application
614
+ - Example usage:
615
+ ```typescript
616
+ const tivioVideoSource = 'videos/2BzH4xsTXW8vqYKJegXj'
617
+ const tivioTvChannelSource = 'tvChannels/Ct4UcK6ozX3VfxaL5yP5'
618
+ ```
619
+ - Otherwise, it is also possible to pass internal tivio source as an object with `type: SourceType.VOD_TIVIO` and additional parameters, similarly to external source type.
600
620
 
601
621
  #### Source Play Modes
602
622
 
package/dist/index.d.ts CHANGED
@@ -2030,6 +2030,8 @@ export declare interface IndexedVideo extends IndexedObject {
2030
2030
  monetizationAccessIds: string[] | false;
2031
2031
  }
2032
2032
 
2033
+ export declare type InputSourceParams = SourceParams | VodExternalMultiSourceParams;
2034
+
2033
2035
  export declare type IntegrationType = 'discord' | 'patreon';
2034
2036
 
2035
2037
  export declare interface InteractiveWidget<T extends InteractiveWidgetScene = InteractiveWidgetScene> {
@@ -7700,6 +7702,14 @@ export declare interface VirtualChannelSourceParams extends ChannelSourceParams
7700
7702
  drm?: Drm;
7701
7703
  }
7702
7704
 
7705
+ /**
7706
+ * Interface representing the parameters for a VOD (Video On Demand) external multi-source configuration.
7707
+ * Multi-source means an array of string URLs representing the external sources for the video content.
7708
+ */
7709
+ export declare interface VodExternalMultiSourceParams extends Omit<VodExternalSourceParams, 'url'> {
7710
+ urls: string[];
7711
+ }
7712
+
7703
7713
  /**
7704
7714
  * @public
7705
7715
  */
@@ -8052,7 +8062,7 @@ export declare interface WebGridScreenProps {
8052
8062
  */
8053
8063
  export declare interface WebPlayerProps {
8054
8064
  id: string;
8055
- source?: SourceParams | VideoPath | ChannelPath | null;
8065
+ source?: InputSourceParams | VideoPath | ChannelPath | null;
8056
8066
  onEnded?: () => any;
8057
8067
  /**
8058
8068
  * If true, the player will inherit the width and height of its parent element.