@coze/realtime-api 1.0.4-beta.1 → 1.0.4

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.
@@ -6,7 +6,10 @@ export declare class EngineClient extends RealtimeEventHandler {
6
6
  private joinUserId;
7
7
  private _AIAnsExtension;
8
8
  private _isSupportVideo;
9
- constructor(appId: string, debug?: boolean, isTestEnv?: boolean, isSupportVideo?: boolean);
9
+ private _videoConfig?;
10
+ private _streamIndex?;
11
+ private _roomUserId?;
12
+ constructor(appId: string, debug?: boolean, isTestEnv?: boolean, isSupportVideo?: boolean, videoConfig?: VideoConfig);
10
13
  bindEngineEvents(): void;
11
14
  removeEventListener(): void;
12
15
  _parseMessage(event: UserMessageEvent): any;
@@ -25,6 +28,7 @@ export declare class EngineClient extends RealtimeEventHandler {
25
28
  }): Promise<void>;
26
29
  setAudioInputDevice(deviceId: string): Promise<void>;
27
30
  setAudioOutputDevice(deviceId: string): Promise<void>;
31
+ setVideoInputDevice(deviceId: string, isAutoCapture?: boolean): Promise<void>;
28
32
  createLocalStream(userId?: string, videoConfig?: VideoConfig): Promise<void>;
29
33
  disconnect(): Promise<void>;
30
34
  changeAudioState(isMicOn: boolean): Promise<void>;
@@ -79,6 +79,11 @@ export declare enum EventNames {
79
79
  * zh: 音频输出设备改变
80
80
  */
81
81
  AUDIO_OUTPUT_DEVICE_CHANGED = "client.output.device.changed",
82
+ /**
83
+ * en: Video input device changed
84
+ * zh: 视频输入设备改变
85
+ */
86
+ VIDEO_INPUT_DEVICE_CHANGED = "client.video.input.device.changed",
82
87
  /**
83
88
  * en: Bot joined
84
89
  * zh: Bot 加入
@@ -1,4 +1,4 @@
1
- import { type AudioPropertiesConfig } from '@volcengine/rtc';
1
+ import { type ScreenConfig, type AudioPropertiesConfig } from '@volcengine/rtc';
2
2
  import { type GetToken } from '@coze/api';
3
3
  import * as RealtimeUtils from './utils';
4
4
  import { RealtimeEventHandler, EventNames } from './event-handler';
@@ -6,6 +6,8 @@ import { RealtimeAPIError, RealtimeError } from './error';
6
6
  export interface VideoConfig {
7
7
  videoOnDefault?: boolean /** optional, Whether to turn on video by default, defaults to true */;
8
8
  renderDom?: string /** optional, The DOM element to render the video stream to */;
9
+ videoInputDeviceId?: string /** optional, The device ID of the video input device to use */;
10
+ screenConfig?: ScreenConfig;
9
11
  }
10
12
  export interface RealtimeClientConfig {
11
13
  accessToken: GetToken /** required, Access Token */;
@@ -62,6 +64,16 @@ declare class RealtimeClient extends RealtimeEventHandler {
62
64
  * @param config.suppressNonStationaryNoise - Optional, suppress non-stationary noise, defaults to false. |
63
65
  * 可选,默认是否抑制非静态噪声,默认值为 false。
64
66
  * @param config.isAutoSubscribeAudio - Optional, whether to automatically subscribe to bot reply audio streams, defaults to true. |
67
+ * @param config.videoConfig - Optional, Video configuration. |
68
+ * 可选,视频配置。
69
+ * @param config.videoConfig.videoOnDefault - Optional, Whether to turn on video by default, defaults to true. |
70
+ * 可选,默认是否开启视频,默认值为 true。
71
+ * @param config.videoConfig.renderDom - Optional, The DOM element to render the video stream to. |
72
+ * 可选,渲染视频流的 DOM 元素。
73
+ * @param config.videoConfig.videoInputDeviceId - Optional, The device ID of the video input device to use. |
74
+ * 可选,视频输入设备的设备 ID。
75
+ * @param config.videoConfig.screenConfig - Optional, Screen share configuration if videoInputDeviceId is 'screenShare' see https://www.volcengine.com/docs/6348/104481#screenconfig for more details. |
76
+ * 可选,屏幕共享配置,如果 videoInputDeviceId 是 'screenShare',请参考 https://www.volcengine.com/docs/6348/104481#screenconfig 了解更多详情。
65
77
  */
66
78
  constructor(config: RealtimeClientConfig);
67
79
  /**
@@ -125,5 +137,6 @@ declare class RealtimeClient extends RealtimeEventHandler {
125
137
  * zh: 设置音频输出设备
126
138
  */
127
139
  setAudioOutputDevice(deviceId: string): Promise<void>;
140
+ setVideoInputDevice(deviceId: string): Promise<void>;
128
141
  }
129
142
  export { RealtimeUtils, RealtimeClient, RealtimeAPIError, RealtimeError, EventNames, };
@@ -13,6 +13,11 @@ export declare const checkPermission: ({ audio, video, }?: {
13
13
  audio?: boolean;
14
14
  video?: boolean;
15
15
  }) => Promise<boolean>;
16
+ /**
17
+ * Checks device permissions for audio and video
18
+ * @param checkVideo Whether to check video permissions (default: false)
19
+ * @returns Promise that resolves with the device permission status
20
+ */
16
21
  export declare const checkDevicePermission: (checkVideo?: boolean) => Promise<{
17
22
  video: boolean;
18
23
  audio: boolean;
@@ -30,3 +35,9 @@ export declare const getAudioDevices: ({ video, }?: {
30
35
  audioOutputs: MediaDeviceInfo[];
31
36
  videoInputs: MediaDeviceInfo[];
32
37
  }>;
38
+ export declare const isScreenShareDevice: (deviceId?: string) => boolean;
39
+ /**
40
+ * Check if browser supports screen sharing
41
+ * 检查浏览器是否支持屏幕共享
42
+ */
43
+ export declare function isScreenShareSupported(): boolean;