sample-xmonitor-js 1.0.8 → 1.0.10

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/Monitor.d.ts CHANGED
@@ -101,7 +101,7 @@ export default class Monitor {
101
101
  * 启动监控
102
102
  */
103
103
  start(): any;
104
- send(message: string): void;
104
+ send(message: string, options?: any): void;
105
105
  /**
106
106
  * 停止监控
107
107
  */
package/lib/Monitor.js CHANGED
@@ -100,7 +100,7 @@ export default class Monitor {
100
100
  this.watcher = new Watcher(this);
101
101
  }
102
102
  isPaused() {
103
- return this.element.paused;
103
+ return this.element instanceof HTMLVideoElement && this.element.paused;
104
104
  }
105
105
  shot() {
106
106
  return this.watcher.shot(this.options.setup?.sharpness).then(img => {
@@ -113,7 +113,7 @@ export default class Monitor {
113
113
  */
114
114
  start() {
115
115
  }
116
- send(message) {
116
+ send(message, options) {
117
117
  throw new NotSupportError('不支持发送消息');
118
118
  }
119
119
  /**
@@ -17,8 +17,11 @@ export default class TxrtcMonitor extends Monitor {
17
17
  /**
18
18
  * 发送自定义消息
19
19
  * @param message
20
+ * @param options
20
21
  */
21
- send(message: string): void;
22
+ send(message: string, options?: {
23
+ cmdId: number;
24
+ }): void;
22
25
  stop(): Promise<any>;
23
26
  static getMonitor(device: Device, object: MObject, element: HTMLDivElement, setup?: Setup): TxrtcMonitor;
24
27
  }
@@ -63,10 +63,11 @@ export default class TxrtcMonitor extends Monitor {
63
63
  /**
64
64
  * 发送自定义消息
65
65
  * @param message
66
+ * @param options
66
67
  */
67
- send(message) {
68
+ send(message, options = { cmdId: 1 }) {
68
69
  this.trtc.sendCustomMessage({
69
- cmdId: Math.ceil(Math.random() * 100),
70
+ ...options,
70
71
  data: new TextEncoder().encode(message).buffer
71
72
  });
72
73
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sample-xmonitor-js",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "",
5
5
  "main": "./lib/index",
6
6
  "files": [