sample-xmonitor-js 1.0.3 → 1.0.5

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.
@@ -1,11 +1,12 @@
1
1
  import Monitor, { Device, MObject, MonitorOptions, Setup } from "../Monitor";
2
- import TRTC, { LocalVideoConfig } from "trtc-sdk-v5";
2
+ import TRTC, { LocalVideoConfig, ScreenShareConfig } from "trtc-sdk-v5";
3
3
  export interface TxrtcSetup extends Setup {
4
4
  userId: string;
5
5
  roomId: string;
6
6
  sdkAppId: number;
7
7
  userSig: string;
8
8
  userDefineRecordId?: string;
9
+ option?: LocalVideoConfig['option'] | ScreenShareConfig['option'];
9
10
  }
10
11
  export default class TxrtcMonitor extends Monitor {
11
12
  private active;
@@ -32,6 +33,8 @@ export declare class TxrtcCameraMonitor extends TxrtcMonitor {
32
33
  /**
33
34
  * 切换摄像头
34
35
  */
35
- switch(option: LocalVideoConfig['option']): Promise<void>;
36
+ switch(option: LocalVideoConfig['option'] & {
37
+ deviceId?: string;
38
+ }): Promise<void>;
36
39
  stop(): Promise<any>;
37
40
  }
@@ -98,7 +98,11 @@ export class TxrtcScreenMonitor extends TxrtcMonitor {
98
98
  }
99
99
  async start() {
100
100
  await super.start();
101
- await this.trtc.startScreenShare({ publish: true, view: this.options.element });
101
+ await this.trtc.startScreenShare({
102
+ option: { profile: '720p', ...this.setup.option },
103
+ publish: true,
104
+ view: this.options.element
105
+ });
102
106
  }
103
107
  async stop() {
104
108
  await this.trtc.stopScreenShare();
@@ -118,14 +122,23 @@ export class TxrtcCameraMonitor extends TxrtcMonitor {
118
122
  async start() {
119
123
  await super.start();
120
124
  await this.trtc.startLocalAudio({ publish: true });
121
- await this.trtc.startLocalVideo({ publish: true, view: this.options.element });
125
+ await this.trtc.startLocalVideo({
126
+ option: { profile: '480p', ...this.setup.option },
127
+ publish: true,
128
+ view: this.options.element
129
+ });
122
130
  }
123
131
  /**
124
132
  * 切换摄像头
125
133
  */
126
134
  async switch(option) {
127
- if (option?.cameraId || option?.useFrontCamera) {
128
- await this.trtc.updateLocalVideo({ option, publish: true, view: this.options.element });
135
+ option.cameraId = option.cameraId || option.deviceId;
136
+ if (option.cameraId || option.useFrontCamera) {
137
+ await this.trtc.updateLocalVideo({
138
+ option: { profile: '480p', ...this.setup.option, ...option },
139
+ publish: true,
140
+ view: this.options.element
141
+ });
129
142
  }
130
143
  }
131
144
  async stop() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sample-xmonitor-js",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "",
5
5
  "main": "./lib/index",
6
6
  "files": [