trtc-sdk-v5 5.19.0 → 5.19.1-beta.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/index.d.ts +63 -4
- package/package.json +1 -1
- package/plugins/audio-player/package.json +1 -1
- package/plugins/cdn-streaming/package.json +1 -1
- package/plugins/chorus/package.json +1 -1
- package/plugins/cross-room/package.json +1 -1
- package/plugins/custom-encryption/package.json +1 -1
- package/plugins/device-detector/package.json +1 -1
- package/plugins/lebplayer/package.json +1 -1
- package/plugins/realtime-transcriber/package.json +1 -1
- package/plugins/small-stream-auto-switcher/package.json +1 -1
- package/plugins/video-decoder/package.json +1 -1
- package/plugins/video-effect/basic-beauty/package.json +1 -1
- package/plugins/video-effect/beauty/package.json +1 -1
- package/plugins/video-effect/face-detection/package.json +1 -1
- package/plugins/video-effect/video-mixer/package.json +1 -1
- package/plugins/video-effect/virtual-background/package.json +1 -1
- package/plugins/video-effect/watermark/package.json +1 -1
- package/plugins/voice-changer/package.json +1 -1
- package/plugins/whiteboard/package.json +1 -1
- package/trtc.esm.js +26 -26
- package/trtc.js +1 -1
package/index.d.ts
CHANGED
|
@@ -557,9 +557,20 @@ export declare const enum TRTCDeviceAction {
|
|
|
557
557
|
Add = 'add',
|
|
558
558
|
Active = 'active'
|
|
559
559
|
}
|
|
560
|
+
export declare interface PermissionNeededEvent {
|
|
561
|
+
mediaType: 'camera' | 'microphone' | 'camera-and-microphone';
|
|
562
|
+
state: 'prompt' | 'denied';
|
|
563
|
+
userMediaElement?: HTMLElement;
|
|
564
|
+
cameraElement?: HTMLElement;
|
|
565
|
+
microphoneElement?: HTMLElement;
|
|
566
|
+
abort: () => void;
|
|
567
|
+
settled: Promise<void>;
|
|
568
|
+
}
|
|
569
|
+
|
|
560
570
|
export declare interface PermissionOption {
|
|
561
571
|
request?: boolean;
|
|
562
572
|
types?: ('camera' | 'microphone')[];
|
|
573
|
+
onPermissionNeeded?: (event: PermissionNeededEvent) => void;
|
|
563
574
|
}
|
|
564
575
|
|
|
565
576
|
export declare interface RealtimeTranscriberStateEvent {
|
|
@@ -1385,7 +1396,33 @@ export declare const TRTCEvent: {
|
|
|
1385
1396
|
* // event.isFullScreen: is in full screen.
|
|
1386
1397
|
* })
|
|
1387
1398
|
*/
|
|
1388
|
-
readonly FULL_SCREEN_STATE_CHANGED: 'full-screen-state-changed'
|
|
1399
|
+
readonly FULL_SCREEN_STATE_CHANGED: 'full-screen-state-changed';
|
|
1400
|
+
/**
|
|
1401
|
+
* @since v5.16.0
|
|
1402
|
+
* @description Permission needed event. Emitted when startLocalVideo or startLocalAudio
|
|
1403
|
+
* encounters a permission issue (state is 'prompt' or 'denied'). The SDK will provide a usermedia element
|
|
1404
|
+
* that the business side should mount into its own dialog UI and guide the user to click the button to authorize.
|
|
1405
|
+
*
|
|
1406
|
+
* - If no listener is registered for this event, the SDK will fallback to its built-in permission dialog.
|
|
1407
|
+
* - If a listener is registered, the SDK will NOT show its built-in dialog and will wait for the user interaction on the provided element.
|
|
1408
|
+
*
|
|
1409
|
+
* @example
|
|
1410
|
+
* trtc.on(TRTC.EVENT.PERMISSION_NEEDED, event => {
|
|
1411
|
+
* // event.state: 'prompt' | 'denied' - current permission state
|
|
1412
|
+
* // event.mediaType: 'camera' | 'microphone' | 'camera-and-microphone' - which media type needs permission
|
|
1413
|
+
* // event.element: HTMLElement - the usermedia element to mount in your dialog
|
|
1414
|
+
* // event.abort: () => void - call this to cancel the permission request
|
|
1415
|
+
*
|
|
1416
|
+
* myDialog.container.appendChild(event.element);
|
|
1417
|
+
* myDialog.show();
|
|
1418
|
+
*
|
|
1419
|
+
* myDialog.onCancel(() => {
|
|
1420
|
+
* event.abort();
|
|
1421
|
+
* myDialog.hide();
|
|
1422
|
+
* });
|
|
1423
|
+
* })
|
|
1424
|
+
*/
|
|
1425
|
+
readonly PERMISSION_NEEDED: 'permission-needed'
|
|
1389
1426
|
};
|
|
1390
1427
|
export declare interface TRTCEventTypes {
|
|
1391
1428
|
[TRTCEvent.ERROR]: [RtcError];
|
|
@@ -1493,7 +1530,13 @@ export declare interface TRTCEventTypes {
|
|
|
1493
1530
|
[TRTCEvent.REALTIME_TRANSCRIBER_MESSAGE]: [RealtimeTranscriberMessageEvent];
|
|
1494
1531
|
[TRTCEvent.REALTIME_TRANSCRIBER_STATE_CHANGED]: [RealtimeTranscriberStateEvent];
|
|
1495
1532
|
[TRTCEvent.PICTURE_IN_PICTURE_STATE_CHANGED]: [PictureInPictureStateChangedEvent];
|
|
1496
|
-
[TRTCEvent.FULL_SCREEN_STATE_CHANGED]: [FullScreenStateChangedEvent]
|
|
1533
|
+
[TRTCEvent.FULL_SCREEN_STATE_CHANGED]: [FullScreenStateChangedEvent];
|
|
1534
|
+
[TRTCEvent.PERMISSION_NEEDED]: [{
|
|
1535
|
+
state: 'prompt' | 'denied';
|
|
1536
|
+
mediaType: 'camera' | 'microphone' | 'camera-and-microphone';
|
|
1537
|
+
element: HTMLElement;
|
|
1538
|
+
abort: () => void;
|
|
1539
|
+
}]
|
|
1497
1540
|
}
|
|
1498
1541
|
|
|
1499
1542
|
export interface PictureInPictureStateChangedEvent {
|
|
@@ -2443,13 +2486,29 @@ export declare class TRTC {
|
|
|
2443
2486
|
* @param {PermissionOption} option
|
|
2444
2487
|
* @param {boolean} [option.request=true] Whether to request permission to use the camera and microphone.
|
|
2445
2488
|
* @param {string[]} [option.types=['camera', 'microphone']] The types of permission to request.
|
|
2489
|
+
* @param {Function} [option.onPermissionNeeded] Callback when permission is needed. When provided, SDK will use `<usermedia>` element (Chrome 152+) to request permission. Falls back to getUserMedia if not supported.
|
|
2446
2490
|
* @returns {Promise<PermissionResult>} Promise returns the permission state of the camera and microphone
|
|
2447
2491
|
* @example
|
|
2492
|
+
* // Basic usage
|
|
2448
2493
|
* const { camera, microphone } = await TRTC.getPermissions({
|
|
2449
|
-
* request: true,
|
|
2494
|
+
* request: true,
|
|
2450
2495
|
* types: ['camera', 'microphone']
|
|
2451
2496
|
* });
|
|
2452
|
-
*
|
|
2497
|
+
*
|
|
2498
|
+
* // With PEPC (Page-Embedded Permission Control)
|
|
2499
|
+
* const { camera, microphone } = await TRTC.getPermissions({
|
|
2500
|
+
* request: true,
|
|
2501
|
+
* types: ['camera', 'microphone'],
|
|
2502
|
+
* onPermissionNeeded: (event) => {
|
|
2503
|
+
* myDialog.show();
|
|
2504
|
+
* if (event.elements.cameraAndMicrophone) {
|
|
2505
|
+
* myDialog.addButton('Allow Camera & Mic', event.elements.cameraAndMicrophone);
|
|
2506
|
+
* }
|
|
2507
|
+
* myDialog.onCancel(() => event.abort());
|
|
2508
|
+
* event.settled.then(() => myDialog.hide());
|
|
2509
|
+
* }
|
|
2510
|
+
* });
|
|
2511
|
+
* console.log(camera, microphone); // 'granted' | 'denied' | 'prompt' | null
|
|
2453
2512
|
*/
|
|
2454
2513
|
static getPermissions(option: PermissionOption): Promise<PermissionResult>;
|
|
2455
2514
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rtc-plugin/audio-player",
|
|
3
|
-
"version": "5.19.
|
|
3
|
+
"version": "5.19.1-beta.2",
|
|
4
4
|
"description": "TRTC Web SDK AudioPlayer plugin - unified audio player supporting PCM, URL, and Track sources",
|
|
5
5
|
"main": "./audio-player.esm.js",
|
|
6
6
|
"module": "./audio-player.esm.js",
|