sample-xmonitor-js 2.0.1 → 2.0.2-beta.0
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.js +9 -3
- package/package.json +1 -1
package/lib/txrtc/index.js
CHANGED
|
@@ -169,10 +169,12 @@ export class TxrtcScreenMonitor extends TxrtcMonitor {
|
|
|
169
169
|
async start() {
|
|
170
170
|
try {
|
|
171
171
|
await super.start();
|
|
172
|
+
const viewElement = this.options.element.querySelector('video')
|
|
173
|
+
|| this.options.element.querySelector('canvas') || this.options.element;
|
|
172
174
|
await this.trtc.startScreenShare({
|
|
173
175
|
option: { profile: '720p', ...this.setup.option },
|
|
174
176
|
publish: true,
|
|
175
|
-
view:
|
|
177
|
+
view: viewElement
|
|
176
178
|
});
|
|
177
179
|
}
|
|
178
180
|
catch (e) {
|
|
@@ -198,10 +200,12 @@ export class TxrtcCameraMonitor extends TxrtcMonitor {
|
|
|
198
200
|
try {
|
|
199
201
|
await super.start();
|
|
200
202
|
await this.trtc.startLocalAudio({ publish: true });
|
|
203
|
+
const viewElement = this.options.element.querySelector('video')
|
|
204
|
+
|| this.options.element.querySelector('canvas') || this.options.element;
|
|
201
205
|
await this.trtc.startLocalVideo({
|
|
202
206
|
option: { profile: '480p', ...this.setup.option },
|
|
203
207
|
publish: true,
|
|
204
|
-
view:
|
|
208
|
+
view: viewElement
|
|
205
209
|
});
|
|
206
210
|
// 检测人脸 需要在调用本地摄像头之后启动该插件
|
|
207
211
|
if (this.setup.faceDetection) {
|
|
@@ -223,10 +227,12 @@ export class TxrtcCameraMonitor extends TxrtcMonitor {
|
|
|
223
227
|
async switch(option) {
|
|
224
228
|
option.cameraId = option.cameraId || option.deviceId;
|
|
225
229
|
if (option.cameraId || option.useFrontCamera) {
|
|
230
|
+
const viewElement = this.options.element.querySelector('video')
|
|
231
|
+
|| this.options.element.querySelector('canvas') || this.options.element;
|
|
226
232
|
await this.trtc.updateLocalVideo({
|
|
227
233
|
option: { profile: '480p', ...this.setup.option, ...option },
|
|
228
234
|
publish: true,
|
|
229
|
-
view:
|
|
235
|
+
view: viewElement
|
|
230
236
|
});
|
|
231
237
|
}
|
|
232
238
|
}
|