sample-xmonitor-js 1.0.4 → 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.
- package/lib/txrtc/index.d.ts +2 -1
- package/lib/txrtc/index.js +15 -3
- package/package.json +1 -1
package/lib/txrtc/index.d.ts
CHANGED
|
@@ -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;
|
package/lib/txrtc/index.js
CHANGED
|
@@ -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({
|
|
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,7 +122,11 @@ 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({
|
|
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
|
* 切换摄像头
|
|
@@ -126,7 +134,11 @@ export class TxrtcCameraMonitor extends TxrtcMonitor {
|
|
|
126
134
|
async switch(option) {
|
|
127
135
|
option.cameraId = option.cameraId || option.deviceId;
|
|
128
136
|
if (option.cameraId || option.useFrontCamera) {
|
|
129
|
-
await this.trtc.updateLocalVideo({
|
|
137
|
+
await this.trtc.updateLocalVideo({
|
|
138
|
+
option: { profile: '480p', ...this.setup.option, ...option },
|
|
139
|
+
publish: true,
|
|
140
|
+
view: this.options.element
|
|
141
|
+
});
|
|
130
142
|
}
|
|
131
143
|
}
|
|
132
144
|
async stop() {
|