@videosdk.live/react-sdk 0.2.1 → 0.2.2
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/dist/index.js +286 -17
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +285 -19
- package/dist/index.modern.js.map +1 -1
- package/dist/types/index.d.ts +164 -1
- package/dist/types/meeting.d.ts +24 -0
- package/package.json +3 -3
package/dist/types/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
// Zujo Now <https://github.com/zujonow>
|
|
6
6
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
7
7
|
|
|
8
|
+
import React, { JSX } from 'react';
|
|
8
9
|
import { Connection } from './connection';
|
|
9
10
|
import {
|
|
10
11
|
CameraDeviceInfo,
|
|
@@ -418,6 +419,34 @@ export function useMediaDevice({
|
|
|
418
419
|
* });
|
|
419
420
|
* ```
|
|
420
421
|
* ---
|
|
422
|
+
* @param onStreamPaused -
|
|
423
|
+
* - It's a callback that gets triggered whenever a participant's stream is paused by adaptive subscription manager.
|
|
424
|
+
* - The `data` parameter contains the reason for pausing.
|
|
425
|
+
*
|
|
426
|
+
* **Code Example :**
|
|
427
|
+
* ```js
|
|
428
|
+
* function onStreamPaused(data) {
|
|
429
|
+
* console.log("Stream paused:", data);
|
|
430
|
+
* }
|
|
431
|
+
* const { displayName } = useParticipant(participantId, {
|
|
432
|
+
* onStreamPaused,
|
|
433
|
+
* });
|
|
434
|
+
* ```
|
|
435
|
+
* ---
|
|
436
|
+
* @param onStreamResumed -
|
|
437
|
+
* - It's a callback that gets triggered whenever a participant's stream is resumed by adaptive subscription manager.
|
|
438
|
+
* - The `stream` parameter contains the reason for resuming.
|
|
439
|
+
*
|
|
440
|
+
* **Code Example :**
|
|
441
|
+
* ```js
|
|
442
|
+
* function onStreamResumed(data) {
|
|
443
|
+
* console.log("Stream resumed:", data);
|
|
444
|
+
* }
|
|
445
|
+
* const { displayName } = useParticipant(participantId, {
|
|
446
|
+
* onStreamResumed,
|
|
447
|
+
* });
|
|
448
|
+
* ```
|
|
449
|
+
* ---
|
|
421
450
|
* @returns This will return particular participant properties and method. You can refer this [API Reference](https://docs.videosdk.live/react/api/sdk-reference/use-participant/introduction)
|
|
422
451
|
*/
|
|
423
452
|
export function useParticipant(
|
|
@@ -426,7 +455,9 @@ export function useParticipant(
|
|
|
426
455
|
onStreamEnabled,
|
|
427
456
|
onStreamDisabled,
|
|
428
457
|
onMediaStatusChanged,
|
|
429
|
-
onVideoQualityChanged
|
|
458
|
+
onVideoQualityChanged,
|
|
459
|
+
onStreamPaused,
|
|
460
|
+
onStreamResumed
|
|
430
461
|
}?: {
|
|
431
462
|
onStreamDisabled?: (stream: Stream) => void;
|
|
432
463
|
onStreamEnabled?: (stream: Stream) => void;
|
|
@@ -448,6 +479,20 @@ export function useParticipant(
|
|
|
448
479
|
prevQuality: 'low' | 'med' | 'high';
|
|
449
480
|
currentQuality: 'low' | 'med' | 'high';
|
|
450
481
|
}) => void;
|
|
482
|
+
onStreamPaused?: ({
|
|
483
|
+
kind,
|
|
484
|
+
reason
|
|
485
|
+
}: {
|
|
486
|
+
kind: 'video';
|
|
487
|
+
reason: string;
|
|
488
|
+
}) => void;
|
|
489
|
+
onStreamResumed?: ({
|
|
490
|
+
kind,
|
|
491
|
+
reason
|
|
492
|
+
}: {
|
|
493
|
+
kind: 'video';
|
|
494
|
+
reason: string;
|
|
495
|
+
}) => void;
|
|
451
496
|
}
|
|
452
497
|
): {
|
|
453
498
|
displayName: string;
|
|
@@ -867,6 +912,13 @@ export function useMeeting({
|
|
|
867
912
|
}
|
|
868
913
|
) => void;
|
|
869
914
|
stopRecording: () => void;
|
|
915
|
+
switchTo: ({
|
|
916
|
+
meetingId,
|
|
917
|
+
token
|
|
918
|
+
}: {
|
|
919
|
+
meetingId: string;
|
|
920
|
+
token?: string;
|
|
921
|
+
}) => void;
|
|
870
922
|
startLiveStream: (
|
|
871
923
|
outputs: Array<{
|
|
872
924
|
url: string;
|
|
@@ -1484,6 +1536,117 @@ export function getNetworkStats({
|
|
|
1484
1536
|
timeoutDuration?: number | undefined;
|
|
1485
1537
|
}): Promise<{ downloadSpeed: number; uploadSpeed: number }>;
|
|
1486
1538
|
|
|
1539
|
+
/**
|
|
1540
|
+
* @param participantId - Unique ID of the participant whose video stream will be rendered.
|
|
1541
|
+
*
|
|
1542
|
+
* ---
|
|
1543
|
+
* @param type - Type of stream to render.
|
|
1544
|
+
* - **"video"**: Renders the participant's webcam video stream.
|
|
1545
|
+
* - **"share"**: Renders the participant's screen share video stream. Observers are not attached for this type.
|
|
1546
|
+
*
|
|
1547
|
+
* ---
|
|
1548
|
+
* @param containerStyle - Custom styles for the video container.
|
|
1549
|
+
*
|
|
1550
|
+
* ---
|
|
1551
|
+
* @param className - Custom class name for the video container.
|
|
1552
|
+
*
|
|
1553
|
+
* ---
|
|
1554
|
+
* @param classNameVideo - Custom class name for the video element inside the container.
|
|
1555
|
+
*
|
|
1556
|
+
* ---
|
|
1557
|
+
* @param videoStyle - Custom styles for the video element inside the container.
|
|
1558
|
+
*
|
|
1559
|
+
* ---
|
|
1560
|
+
* @returns A React component that renders the participant's video stream with optional adaptive observers.
|
|
1561
|
+
*
|
|
1562
|
+
* **Code Example:**
|
|
1563
|
+
* ```tsx
|
|
1564
|
+
* <VideoPlayer
|
|
1565
|
+
* participantId="participant123"
|
|
1566
|
+
* type="video"
|
|
1567
|
+
* containerStyle={{ border: "1px solid red" }}
|
|
1568
|
+
* className="custom-container"
|
|
1569
|
+
* classNameVideo="custom-video"
|
|
1570
|
+
* videoStyle={{ objectFit: "cover" }}
|
|
1571
|
+
* />
|
|
1572
|
+
* ```
|
|
1573
|
+
*/
|
|
1574
|
+
export function VideoPlayer({
|
|
1575
|
+
participantId,
|
|
1576
|
+
type,
|
|
1577
|
+
containerStyle,
|
|
1578
|
+
className,
|
|
1579
|
+
classNameVideo,
|
|
1580
|
+
videoStyle
|
|
1581
|
+
}: {
|
|
1582
|
+
participantId: string;
|
|
1583
|
+
type?: "video" | "share";
|
|
1584
|
+
containerStyle?: React.CSSProperties;
|
|
1585
|
+
className?: string;
|
|
1586
|
+
classNameVideo?: string;
|
|
1587
|
+
videoStyle?: React.CSSProperties;
|
|
1588
|
+
}): JSX.Element;
|
|
1589
|
+
|
|
1590
|
+
/**
|
|
1591
|
+
* @param participantId - Unique ID of the participant whose audio stream will be rendered.
|
|
1592
|
+
*
|
|
1593
|
+
* ---
|
|
1594
|
+
* @param type - Type of audio stream to render.
|
|
1595
|
+
* - **"audio"**: Renders the participant's microphone audio stream.
|
|
1596
|
+
* - **"shareAudio"**: Renders the participant's screen share audio stream.
|
|
1597
|
+
*
|
|
1598
|
+
* ---
|
|
1599
|
+
* @returns A React component that renders the participant's audio stream.
|
|
1600
|
+
*
|
|
1601
|
+
* **Code Example:**
|
|
1602
|
+
* ```tsx
|
|
1603
|
+
* <AudioPlayer
|
|
1604
|
+
* participantId="participant123"
|
|
1605
|
+
* type="audio"
|
|
1606
|
+
* />
|
|
1607
|
+
* ```
|
|
1608
|
+
*/
|
|
1609
|
+
export function AudioPlayer({
|
|
1610
|
+
participantId,
|
|
1611
|
+
type
|
|
1612
|
+
}: {
|
|
1613
|
+
participantId: string;
|
|
1614
|
+
type?: "audio" | "shareAudio";
|
|
1615
|
+
}): JSX.Element;
|
|
1616
|
+
|
|
1617
|
+
/**
|
|
1618
|
+
* @param VideoPlayerComponent - The base video player component to be enhanced with adaptive observers.
|
|
1619
|
+
*
|
|
1620
|
+
* ---
|
|
1621
|
+
* @param intersectionObserverOptions - Options for the IntersectionObserver.
|
|
1622
|
+
*
|
|
1623
|
+
* ---
|
|
1624
|
+
* @param debounceDelay - Delay in milliseconds for debouncing observer callbacks.
|
|
1625
|
+
*
|
|
1626
|
+
* ---
|
|
1627
|
+
* @returns A Higher-Order Component (HOC) that wraps the provided video player component and adds adaptive observers.
|
|
1628
|
+
*
|
|
1629
|
+
* **Code Example:**
|
|
1630
|
+
* ```tsx
|
|
1631
|
+
* const EnhancedVideoPlayer = withAdaptiveObservers(VideoPlayer, {
|
|
1632
|
+
* root: null,
|
|
1633
|
+
* rootMargin: "0px",
|
|
1634
|
+
* threshold: 0
|
|
1635
|
+
* }, 400);
|
|
1636
|
+
*
|
|
1637
|
+
* <EnhancedVideoPlayer participantId="participant123" type="video" />;
|
|
1638
|
+
* ```
|
|
1639
|
+
*/
|
|
1640
|
+
export function withAdaptiveObservers(
|
|
1641
|
+
VideoPlayerComponent: React.ComponentType<any>,
|
|
1642
|
+
intersectionObserverOptions?: {
|
|
1643
|
+
root?: Element | null;
|
|
1644
|
+
rootMargin?: string;
|
|
1645
|
+
threshold?: number | number[];
|
|
1646
|
+
},
|
|
1647
|
+
debounceDelay?: number
|
|
1648
|
+
): React.ComponentType<any>;
|
|
1649
|
+
|
|
1487
1650
|
export const Constants: {
|
|
1488
1651
|
errors: {
|
|
1489
1652
|
INVALID_API_KEY: number;
|
package/dist/types/meeting.d.ts
CHANGED
|
@@ -296,6 +296,19 @@ export class Meeting {
|
|
|
296
296
|
*/
|
|
297
297
|
changeMic(object: string | MediaStream): void;
|
|
298
298
|
|
|
299
|
+
/**
|
|
300
|
+
* @description This method is used to switch to a different meeting
|
|
301
|
+
* @param meetingId The ID of the meeting to switch to (mandatory)
|
|
302
|
+
* @param token The token for the new meeting (optional)
|
|
303
|
+
*/
|
|
304
|
+
switchTo({
|
|
305
|
+
meetingId,
|
|
306
|
+
token
|
|
307
|
+
}: {
|
|
308
|
+
meetingId: string;
|
|
309
|
+
token?: string;
|
|
310
|
+
}): void;
|
|
311
|
+
|
|
299
312
|
/**
|
|
300
313
|
*
|
|
301
314
|
* @param object These can be the `deviceId` to which the webcam input has to be changed or
|
|
@@ -348,6 +361,17 @@ export class Meeting {
|
|
|
348
361
|
* @param options
|
|
349
362
|
*/
|
|
350
363
|
seekVideo({ currentTime }: { currentTime: number }): void;
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* @description Enables Adaptive Subscription, which dynamically adjusts the subscribed video streams
|
|
367
|
+
* based on participant visibility and network conditions to optimize performance in large meetings.
|
|
368
|
+
*/
|
|
369
|
+
enableAdaptiveSubscription(): void;
|
|
370
|
+
/**
|
|
371
|
+
* @description Disables Adaptive Subscription, forcing all subscribed video streams to remain active
|
|
372
|
+
* regardless of participant visibility or network conditions.
|
|
373
|
+
*/
|
|
374
|
+
disableAdaptiveSubscription(): void;
|
|
351
375
|
pubSub: {
|
|
352
376
|
/**
|
|
353
377
|
* Publish message to a topic
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@videosdk.live/react-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.modern.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"lint": "eslint 'src/**/*.js'"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
|
-
"react": "^16.13.1 || ^17 || ^18"
|
|
16
|
+
"react": "^16.13.1 || ^17 || ^18 || ^19"
|
|
17
17
|
},
|
|
18
18
|
"keywords": [
|
|
19
19
|
"react",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@videosdk.live/js-sdk": "0.1.
|
|
77
|
+
"@videosdk.live/js-sdk": "0.1.6",
|
|
78
78
|
"events": "^3.3.0"
|
|
79
79
|
}
|
|
80
80
|
}
|