@ray-js/ray-ipc-player 0.0.13-beta-1

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.
Files changed (46) hide show
  1. package/README.md +107 -0
  2. package/lib/constant.android.js +1 -0
  3. package/lib/constant.d.ts +23 -0
  4. package/lib/constant.ios.js +1 -0
  5. package/lib/constant.js +28 -0
  6. package/lib/constant.tuya.js +28 -0
  7. package/lib/constant.web.js +28 -0
  8. package/lib/constant.wechat.js +28 -0
  9. package/lib/i18n/index.android.js +1 -0
  10. package/lib/i18n/index.d.ts +3 -0
  11. package/lib/i18n/index.ios.js +1 -0
  12. package/lib/i18n/index.js +4 -0
  13. package/lib/i18n/index.tuya.js +4 -0
  14. package/lib/i18n/index.web.js +4 -0
  15. package/lib/i18n/index.wechat.js +4 -0
  16. package/lib/i18n/strings.android.js +1 -0
  17. package/lib/i18n/strings.d.ts +1521 -0
  18. package/lib/i18n/strings.ios.js +1 -0
  19. package/lib/i18n/strings.js +1520 -0
  20. package/lib/i18n/strings.json +1569 -0
  21. package/lib/i18n/strings.tuya.js +1520 -0
  22. package/lib/i18n/strings.web.js +1520 -0
  23. package/lib/i18n/strings.wechat.js +1520 -0
  24. package/lib/index.android.js +1 -0
  25. package/lib/index.config.android.js +1 -0
  26. package/lib/index.config.ios.js +1 -0
  27. package/lib/index.config.js +4 -0
  28. package/lib/index.config.tuya.js +4 -0
  29. package/lib/index.config.web.js +4 -0
  30. package/lib/index.config.wechat.js +4 -0
  31. package/lib/index.d.ts +3 -0
  32. package/lib/index.ios.js +1 -0
  33. package/lib/index.js +497 -0
  34. package/lib/index.module.less +127 -0
  35. package/lib/index.tuya.js +497 -0
  36. package/lib/index.web.js +497 -0
  37. package/lib/index.wechat.js +497 -0
  38. package/lib/typings/index.d.ts +153 -0
  39. package/lib/utils.android.js +1 -0
  40. package/lib/utils.d.ts +1 -0
  41. package/lib/utils.ios.js +1 -0
  42. package/lib/utils.js +19 -0
  43. package/lib/utils.tuya.js +19 -0
  44. package/lib/utils.web.js +19 -0
  45. package/lib/utils.wechat.js +19 -0
  46. package/package.json +87 -0
@@ -0,0 +1,497 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ import "core-js/modules/es.object.to-string.js";
4
+ import "core-js/modules/es.promise.js";
5
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
6
+ import React, { useEffect, useRef, useCallback } from 'react';
7
+ import { useImmer } from 'use-immer';
8
+ import { IpcPlayer, View, Text, CoverView } from '@ray-js/components';
9
+ import cx from 'classnames';
10
+ import { usePageEvent } from 'ray';
11
+ import locals from './i18n';
12
+ import Styles from './index.module.less';
13
+ import { IpcFailCode } from './constant';
14
+ import { putDpData } from './utils';
15
+
16
+ var Player = function (props) {
17
+ var _props$updateLayout = props.updateLayout,
18
+ updateLayout = _props$updateLayout === void 0 ? '' : _props$updateLayout,
19
+ _props$devId = props.devId,
20
+ devId = _props$devId === void 0 ? '' : _props$devId,
21
+ _props$devName = props.devName,
22
+ devName = _props$devName === void 0 ? '' : _props$devName,
23
+ onChangeStreamStatus = props.onChangeStreamStatus,
24
+ onPlayerTap = props.onPlayerTap,
25
+ onInitPreview = props.onInitPreview,
26
+ _props$defaultMute = props.defaultMute,
27
+ defaultMute = _props$defaultMute === void 0 ? true : _props$defaultMute,
28
+ _props$onlineStatus = props.onlineStatus,
29
+ onlineStatus = _props$onlineStatus === void 0 ? true : _props$onlineStatus,
30
+ _props$loadDes = props.loadDes,
31
+ loadDes = _props$loadDes === void 0 ? '' : _props$loadDes,
32
+ _props$rotateZ = props.rotateZ,
33
+ rotateZ = _props$rotateZ === void 0 ? 0 : _props$rotateZ,
34
+ _props$scalable = props.scalable,
35
+ scalable = _props$scalable === void 0 ? true : _props$scalable,
36
+ _props$scaleMultiple = props.scaleMultiple,
37
+ scaleMultiple = _props$scaleMultiple === void 0 ? 0 : _props$scaleMultiple,
38
+ _props$ptzControllabl = props.ptzControllable,
39
+ ptzControllable = _props$ptzControllabl === void 0 ? true : _props$ptzControllabl,
40
+ _props$isOnPlayerPage = props.isOnPlayerPage,
41
+ isOnPlayerPage = _props$isOnPlayerPage === void 0 ? true : _props$isOnPlayerPage,
42
+ _props$clarity = props.clarity,
43
+ clarity = _props$clarity === void 0 ? 'normal' : _props$clarity,
44
+ _props$soundMode = props.soundMode,
45
+ soundMode = _props$soundMode === void 0 ? 'speaker' : _props$soundMode,
46
+ _props$orientation = props.orientation,
47
+ orientation = _props$orientation === void 0 ? 'vertical' : _props$orientation,
48
+ onCtx = props.onCtx,
49
+ _props$borderRadius = props.borderRadius,
50
+ borderRadius = _props$borderRadius === void 0 ? 0 : _props$borderRadius,
51
+ _props$bgColor = props.bgColor,
52
+ bgColor = _props$bgColor === void 0 ? '#000000' : _props$bgColor,
53
+ _props$borderStyle = props.borderStyle,
54
+ borderStyle = _props$borderStyle === void 0 ? 'solid' : _props$borderStyle,
55
+ _props$borderColor = props.borderColor,
56
+ borderColor = _props$borderColor === void 0 ? '' : _props$borderColor,
57
+ _props$borderWidth = props.borderWidth,
58
+ borderWidth = _props$borderWidth === void 0 ? 0 : _props$borderWidth,
59
+ _props$privateState = props.privateState,
60
+ privateState = _props$privateState === void 0 ? false : _props$privateState;
61
+
62
+ var _useImmer = useImmer({
63
+ connectState: false,
64
+ // 连接状态
65
+ loadingState: false,
66
+ // 加载状态
67
+ errorState: false,
68
+ // 异常状态
69
+ errorMsg: '',
70
+ // 异常信息
71
+ updateLy: '',
72
+ devlineState: true,
73
+ initLy: false
74
+ }),
75
+ _useImmer2 = _slicedToArray(_useImmer, 2),
76
+ playState = _useImmer2[0],
77
+ setPlayState = _useImmer2[1];
78
+
79
+ var ipcCtx = useRef(null); // ipc实例
80
+
81
+ var retryCount = useRef(0); // 重试次数
82
+
83
+ var muteRef = useRef(defaultMute); // 静音
84
+
85
+ usePageEvent('onShow', useCallback(function () {
86
+ // console.log('show');
87
+ if (ipcCtx.current && playState.connectState) {
88
+ startPreview('');
89
+ }
90
+ }, [playState.connectState]));
91
+ usePageEvent('onHide', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
92
+ return _regeneratorRuntime.wrap(function (_context) {
93
+ while (1) {
94
+ switch (_context.prev = _context.next) {
95
+ case 0:
96
+ // console.log('hide');
97
+ setPlayState(function (d) {
98
+ d.loadingState = true;
99
+ });
100
+ _context.next = 3;
101
+ return getCurMute();
102
+
103
+ case 3:
104
+ stopPreview();
105
+
106
+ case 4:
107
+ case "end":
108
+ return _context.stop();
109
+ }
110
+ }
111
+ }, _callee);
112
+ }))); // 隐私模式
113
+
114
+ useEffect(function () {
115
+ setPlayState(function (d) {
116
+ d.errorState = privateState;
117
+ });
118
+
119
+ if (!privateState) {
120
+ retry();
121
+ }
122
+ }, [privateState]);
123
+ useEffect(function () {
124
+ muteRef.current = defaultMute;
125
+ }, [defaultMute]);
126
+ useEffect(function () {
127
+ setPlayState(function (d) {
128
+ d.updateLy = updateLayout;
129
+ });
130
+ }, [updateLayout]); // 设备离线
131
+
132
+ useEffect(function () {
133
+ setPlayState(function (d) {
134
+ d.devlineState = onlineStatus;
135
+ });
136
+
137
+ if (!onlineStatus) {
138
+ setPlayState(function (d) {
139
+ d.errorState = true;
140
+ d.errorMsg = locals.getLang('ipc_player_no_line');
141
+ });
142
+ } else if (playState.initLy) {
143
+ retry();
144
+ }
145
+ }, [onlineStatus, playState.initLy]);
146
+ useEffect(function () {
147
+ if (!isOnPlayerPage) {
148
+ disconnect();
149
+ }
150
+ }, [isOnPlayerPage]); // 重试
151
+
152
+ var _retry = /*#__PURE__*/function () {
153
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
154
+ return _regeneratorRuntime.wrap(function (_context2) {
155
+ while (1) {
156
+ switch (_context2.prev = _context2.next) {
157
+ case 0:
158
+ setPlayState(function (d) {
159
+ d.connectState = false;
160
+ d.errorMsg = '';
161
+ d.errorState = false;
162
+ });
163
+ _context2.t0 = playState.connectState;
164
+
165
+ if (!_context2.t0) {
166
+ _context2.next = 5;
167
+ break;
168
+ }
169
+
170
+ _context2.next = 5;
171
+ return disconnect();
172
+
173
+ case 5:
174
+ createConnect();
175
+
176
+ case 6:
177
+ case "end":
178
+ return _context2.stop();
179
+ }
180
+ }
181
+ }, _callee2);
182
+ }));
183
+
184
+ return function () {
185
+ return _ref2.apply(this, arguments);
186
+ };
187
+ }();
188
+
189
+ var retry = useCallback(function () {
190
+ // console.log('retry:', muteRef.current);
191
+ !privateState && _retry();
192
+ }, [playState.connectState, privateState]); // 创建ipc实例
193
+
194
+ var createIpcCtx = function (id) {
195
+ var _ty;
196
+
197
+ // @ts-ignore
198
+ ipcCtx.current = (_ty = ty) === null || _ty === void 0 ? void 0 : _ty.createIpcPlayerContext(id); // console.log('创建实例:', devId);
199
+
200
+ onCtx && onCtx({
201
+ ctx: ipcCtx.current,
202
+ retry: retry
203
+ });
204
+ };
205
+
206
+ useEffect(function () {
207
+ onlineStatus && createIpcCtx(devId);
208
+ return function () {
209
+ disconnect();
210
+ ipcCtx.current = null;
211
+ };
212
+ }, [devId, onlineStatus]); // 建立连接
213
+
214
+ var createConnect = function (params) {
215
+ var _ipcCtx$current;
216
+
217
+ // console.log('建立连接:', devId);
218
+ setPlayState(function (d) {
219
+ d.loadingState = true;
220
+ });
221
+ (_ipcCtx$current = ipcCtx.current) === null || _ipcCtx$current === void 0 ? void 0 : _ipcCtx$current.connect({
222
+ success: function success() {
223
+ // console.log('建立连接成功:', devId);
224
+ setPlayState(function (d) {
225
+ d.connectState = true;
226
+ d.errorState = false;
227
+ d.errorMsg = '';
228
+ });
229
+ onChangeStreamStatus && onChangeStreamStatus(1001);
230
+ startPreview(params);
231
+ },
232
+ fail: function fail() {
233
+ // console.log('建立连接失败:', devId);
234
+ setPlayState(function (d) {
235
+ d.connectState = false;
236
+ d.errorState = true;
237
+ d.errorMsg = locals.getLang('ipc_player_connect_fail');
238
+ d.loadingState = false;
239
+ });
240
+ onChangeStreamStatus && onChangeStreamStatus(-1001);
241
+ }
242
+ });
243
+ }; // 视图层准备就绪,开始建立连接
244
+
245
+
246
+ // 开启预览
247
+ var startPreview = function (params) {
248
+ var _ipcCtx$current2;
249
+
250
+ (_ipcCtx$current2 = ipcCtx.current) === null || _ipcCtx$current2 === void 0 ? void 0 : _ipcCtx$current2.startPreview({
251
+ success: function success() {
252
+ // console.log('开启预览:', devId);
253
+ setPlayState(function (d) {
254
+ d.loadingState = false;
255
+ d.errorState = false;
256
+ d.errorMsg = '';
257
+ });
258
+ params && onInitPreview && onInitPreview(devId);
259
+ onChangeStreamStatus && onChangeStreamStatus(1002);
260
+ },
261
+ fail: function fail() {
262
+ // console.log('开启失败:', devId);
263
+ setPlayState(function (d) {
264
+ d.errorState = true;
265
+ d.loadingState = false;
266
+ d.errorMsg = locals.getLang('ipc_player_preview_fail');
267
+ });
268
+ onChangeStreamStatus && onChangeStreamStatus(-1002);
269
+ },
270
+ complete: function complete() {
271
+ // console.log('startPreview:', muteRef.current);
272
+ setMuted(muteRef.current);
273
+ }
274
+ });
275
+ }; // 暂停预览
276
+
277
+
278
+ var stopPreview = function () {
279
+ var _ipcCtx$current3;
280
+
281
+ (_ipcCtx$current3 = ipcCtx.current) === null || _ipcCtx$current3 === void 0 ? void 0 : _ipcCtx$current3.stopPreview({
282
+ success: function success() {
283
+ return null;
284
+ },
285
+ fail: function fail() {
286
+ return null;
287
+ },
288
+ complete: function complete() {
289
+ return setMuted(true);
290
+ }
291
+ });
292
+ }; // 设置静音
293
+
294
+
295
+ var setMuted = function (val) {
296
+ var _ipcCtx$current4;
297
+
298
+ (_ipcCtx$current4 = ipcCtx.current) === null || _ipcCtx$current4 === void 0 ? void 0 : _ipcCtx$current4.setMuted({
299
+ mute: val,
300
+ success: function success() {// console.log('设置声音成功', val);
301
+ },
302
+ fail: function fail() {// console.log('设置声音失败');
303
+ }
304
+ });
305
+ }; // 获取当前是否静音
306
+
307
+
308
+ var getCurMute = function () {
309
+ return new Promise(function (resolve, reject) {
310
+ var _ipcCtx$current5;
311
+
312
+ (_ipcCtx$current5 = ipcCtx.current) === null || _ipcCtx$current5 === void 0 ? void 0 : _ipcCtx$current5.isMuted({
313
+ success: function success(res) {
314
+ muteRef.current = res;
315
+ },
316
+ fail: function fail(e) {
317
+ reject(e); // console.log(e);
318
+ },
319
+ complete: function complete(d) {
320
+ resolve(d);
321
+ }
322
+ });
323
+ });
324
+ }; // 异常事件
325
+
326
+
327
+ var onError = useCallback(function (e) {
328
+ var _e$detail;
329
+
330
+ if (playState.errorState) {
331
+ return;
332
+ } // console.error('发生错误:', e);
333
+
334
+
335
+ var type = e === null || e === void 0 ? void 0 : (_e$detail = e.detail) === null || _e$detail === void 0 ? void 0 : _e$detail.errCode;
336
+
337
+ if (IpcFailCode[type]) {
338
+ onChangeStreamStatus && onChangeStreamStatus(type);
339
+ setPlayState(function (d) {
340
+ d.loadingState = false;
341
+ d.errorState = true;
342
+ d.errorMsg = locals.getLang(IpcFailCode[type]);
343
+ d.connectState = false;
344
+ });
345
+ }
346
+ }, [playState.errorState]); // 连接状态发生变化
347
+
348
+ // 断开连接
349
+ var disconnect = function () {
350
+ return new Promise(function (resolve, reject) {
351
+ var _ipcCtx$current6;
352
+
353
+ (_ipcCtx$current6 = ipcCtx.current) === null || _ipcCtx$current6 === void 0 ? void 0 : _ipcCtx$current6.disconnect({
354
+ success: function success(res) {
355
+ // console.log('断开连接成功:', devId);
356
+ resolve(res);
357
+ setPlayState(function (d) {
358
+ d.connectState = false;
359
+ });
360
+ onChangeStreamStatus && onChangeStreamStatus(1009);
361
+ },
362
+ fail: function fail(e) {
363
+ // console.log('断开连接失败:', devId);
364
+ reject(e);
365
+ onChangeStreamStatus && onChangeStreamStatus(-1009);
366
+ }
367
+ });
368
+ });
369
+ };
370
+
371
+ // 关闭隐私模式,重新拉流
372
+ var handleReWakeCamera = /*#__PURE__*/function () {
373
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
374
+ return _regeneratorRuntime.wrap(function (_context3) {
375
+ while (1) {
376
+ switch (_context3.prev = _context3.next) {
377
+ case 0:
378
+ _context3.next = 2;
379
+ return putDpData({
380
+ 105: false
381
+ }, devId);
382
+
383
+ case 2:
384
+ case "end":
385
+ return _context3.stop();
386
+ }
387
+ }
388
+ }, _callee3);
389
+ }));
390
+
391
+ return function () {
392
+ return _ref3.apply(this, arguments);
393
+ };
394
+ }();
395
+
396
+ return /*#__PURE__*/React.createElement(View, {
397
+ className: Styles.ipc_player
398
+ }, isOnPlayerPage && /*#__PURE__*/React.createElement(IpcPlayer, {
399
+ className: Styles.player,
400
+ onVideotap: function handlePlayerClick() {
401
+ // console.log("videoTap:", devId);
402
+ onPlayerTap && onPlayerTap(devId);
403
+ },
404
+ onInitdone: function initdone() {
405
+ // console.log('视图层准备就绪:', devId);
406
+ setPlayState(function (d) {
407
+ d.updateLy = Math.random();
408
+ d.initLy = true;
409
+ });
410
+ },
411
+ onError: onError,
412
+ onConnectchange: function connectchange(e) {
413
+ var _e$detail2;
414
+
415
+ // console.log('连接状态发生变化', e);
416
+ var code = e === null || e === void 0 ? void 0 : (_e$detail2 = e.detail) === null || _e$detail2 === void 0 ? void 0 : _e$detail2.state;
417
+ onChangeStreamStatus && onChangeStreamStatus(code === 0 ? 1001 : -1001);
418
+
419
+ if (code === 0) {
420
+ setPlayState(function (d) {
421
+ d.connectState = true;
422
+ });
423
+ } else if ((code === -3 || code === -105) && retryCount.current < 1) {
424
+ // 连接超时或鉴权失败重试一次
425
+ retryCount.current++;
426
+ retry();
427
+ } else {
428
+ setPlayState(function (d) {
429
+ d.connectState = false;
430
+ d.loadingState = false;
431
+ d.errorState = true;
432
+ d.errorMsg = locals.getLang(IpcFailCode[-1001]);
433
+ });
434
+ }
435
+ },
436
+ deviceId: devId,
437
+ autoPauseIfNavigate: false,
438
+ autoPauseIfOpenNative: false,
439
+ muted: defaultMute,
440
+ objectFit: "fillCrop",
441
+ clarity: clarity,
442
+ soundMode: soundMode,
443
+ orientation: orientation,
444
+ rotateZ: rotateZ,
445
+ scalable: scalable,
446
+ scaleMultiple: scaleMultiple,
447
+ ptzControllable: ptzControllable,
448
+ borderRadius: borderRadius,
449
+ borderStyle: borderStyle,
450
+ borderColor: borderColor,
451
+ borderWidth: borderWidth,
452
+ updateLayout: playState.updateLy,
453
+ backgroundColor: bgColor
454
+ }), /*#__PURE__*/React.createElement(View, {
455
+ style: {
456
+ borderRadius: "".concat(borderRadius)
457
+ },
458
+ className: cx(Styles.load_box, Styles.bg_center, !playState.loadingState && Styles.hide)
459
+ }, /*#__PURE__*/React.createElement(View, {
460
+ className: Styles.load_icon
461
+ }), /*#__PURE__*/React.createElement(View, {
462
+ className: Styles.load_des
463
+ }, loadDes || locals.getLang('get_video_stream'))), /*#__PURE__*/React.createElement(CoverView, {
464
+ style: {
465
+ borderRadius: "".concat(borderRadius)
466
+ },
467
+ className: cx(Styles.bg_center, Styles.state_label, !playState.errorState && Styles.hide)
468
+ }, privateState ? /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(View, {
469
+ className: Styles.device_sleep
470
+ }, locals.getLang('device_sleep')), /*#__PURE__*/React.createElement(View, {
471
+ className: Styles.re_wake_camera // @ts-ignore
472
+ ,
473
+ onClick: handleReWakeCamera
474
+ }, locals.getLang('re_wake_camera'))) : /*#__PURE__*/React.createElement(View, {
475
+ style: {
476
+ width: '95%',
477
+ textAlign: 'center'
478
+ }
479
+ }, /*#__PURE__*/React.createElement(View, {
480
+ className: cx(Styles.iconfont, Styles.icon_tishi, !playState.devlineState && Styles.hide)
481
+ }), /*#__PURE__*/React.createElement(View, {
482
+ className: Styles.err_msg
483
+ }, /*#__PURE__*/React.createElement(View, {
484
+ className: cx(Styles.msg, Styles.ellipsis)
485
+ }, playState.errorMsg), /*#__PURE__*/React.createElement(Text, {
486
+ style: {
487
+ color: '#fff'
488
+ },
489
+ className: !playState.devlineState && Styles.hide
490
+ }, "\uFF0C"), /*#__PURE__*/React.createElement(View // @ts-ignore
491
+ , {
492
+ onClick: retry,
493
+ className: cx(Styles.retry, !playState.devlineState && Styles.hide)
494
+ }, locals.getLang('ipc_player_retry'))))));
495
+ };
496
+
497
+ export default Player;
@@ -0,0 +1,153 @@
1
+ declare module '*.module.less' {
2
+ const classes: {
3
+ readonly [key: string]: string;
4
+ };
5
+ export default classes;
6
+ declare module '*.less';
7
+ }
8
+ export type IProps = {
9
+ /**
10
+ * @description.en updateLayout
11
+ * @description.zh 主动触发视图更新
12
+ * @default ""
13
+ */
14
+ updateLayout?: any;
15
+ /**
16
+ * @description.en devId
17
+ * @description.zh 设备id
18
+ * @default ""
19
+ */
20
+ devId: string;
21
+ /**
22
+ * @description.en devName
23
+ * @description.zh 设备名称
24
+ * @default ""
25
+ */
26
+ devName?: string;
27
+ /**
28
+ * @description.en onInitPreview
29
+ * @description.zh 初始化预览成功通知
30
+ * @default (data) => void
31
+ */
32
+ onInitPreview?: (data) => void;
33
+ /**
34
+ * @description.en onPlayerTap
35
+ * @description.zh videoTap点击事件
36
+ * @default (data) => void
37
+ */
38
+ onPlayerTap?: (data) => void;
39
+ /**
40
+ * @description.en onChangeStreamStatus
41
+ * @description.zh 通知视频流状态发生变化
42
+ * @default (data) => void
43
+ */
44
+ onChangeStreamStatus?: (data) => void;
45
+ /**
46
+ * @description.en onlineStatus
47
+ * @description.zh 设备默认在离线状态,true:在线、false:离线
48
+ * @default true
49
+ */
50
+ onlineStatus?: boolean;
51
+ /**
52
+ * @description.en loadDes
53
+ * @description.zh 加载文案
54
+ * @default "正在获取视频流..."
55
+ */
56
+ loadDes?: string;
57
+ /**
58
+ * @description.en rotateZ
59
+ * @description.zh 摄像头旋转角度
60
+ * @default 0
61
+ */
62
+ rotateZ?: number;
63
+ /**
64
+ * @description.en scalable
65
+ * @description.zh 是否可缩放
66
+ * @default true
67
+ */
68
+ scalable?: boolean;
69
+ /**
70
+ * @description.en scaleMultiple
71
+ * @description.zh 缩放比例
72
+ * @default 0
73
+ */
74
+ scaleMultiple?: number;
75
+ /**
76
+ * @description.en ptzControllable
77
+ * @description.zh 是否开启视频区云平台控制
78
+ * @default true
79
+ */
80
+ ptzControllable?: boolean;
81
+ /**
82
+ * @description.en isOnPlayerPage
83
+ * @description.zh 当前是否在预览页
84
+ * @default true
85
+ */
86
+ isOnPlayerPage?: boolean;
87
+ /**
88
+ * @description.en onCtx
89
+ * @description.zh 获取ipcPlayer实例ctx以及重试方法retry
90
+ * @default (playerRef) => void
91
+ */
92
+ onCtx?: (playerRef) => void;
93
+ /**
94
+ * @description.en defaultMute
95
+ * @description.zh 是否静音
96
+ * @default true
97
+ */
98
+ defaultMute?: boolean;
99
+ /**
100
+ * @description.en clarity
101
+ * @description.zh 清晰度 normal:标清,hd:高清
102
+ * @default "normal"
103
+ */
104
+ clarity?: 'normal' | 'hd';
105
+ /**
106
+ * @description.en soundMode
107
+ * @description.zh 声音输出方式 speaker:扬声器,ear:听筒
108
+ * @default "speaker"
109
+ */
110
+ soundMode?: 'speaker' | 'ear';
111
+ /**
112
+ * @description.en orientation
113
+ * @description.zh 画面方向 vertical:竖直,horizontal:水平
114
+ * @default "vertical"
115
+ */
116
+ orientation?: 'vertical' | 'horizontal';
117
+ /**
118
+ * @description.en borderRadius
119
+ * @description.zh player边框圆角
120
+ * @default 0
121
+ */
122
+ borderRadius?: number | string;
123
+ /**
124
+ * @description.en bgColor
125
+ * @description.zh 背景底色
126
+ * @default "#000000"
127
+ */
128
+ bgColor?: string;
129
+ /**
130
+ * @description.en borderStyle
131
+ * @description.zh 边框样式
132
+ * @default "solid"
133
+ */
134
+ borderStyle?: 'solid' | 'dashed';
135
+ /**
136
+ * @description.en borderColor
137
+ * @description.zh 边框颜色
138
+ * @default ""
139
+ */
140
+ borderColor?: string;
141
+ /**
142
+ * @description.en borderWidth
143
+ * @description.zh 边框宽度
144
+ * @default ""
145
+ */
146
+ borderWidth?: string | number;
147
+ /**
148
+ * @description.en privateState
149
+ * @description.zh 隐私模式
150
+ * @default false
151
+ */
152
+ privateState?: boolean;
153
+ };
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,"__esModule",{value:true});exports.putDpData=void 0;var putDpData=function(dpIds,deviceId){return new Promise(function(resolve,reject){ty.device.publishDps({deviceId:deviceId,mode:2,pipelines:[],options:{},dps:dpIds,success:function success(res){return resolve(res);},fail:function fail(e){return reject(e);}});});};exports.putDpData=putDpData;
package/lib/utils.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const putDpData: (dpIds: Record<number, boolean>, deviceId?: string) => Promise<unknown>;
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,"__esModule",{value:true});exports.putDpData=void 0;var putDpData=function(dpIds,deviceId){return new Promise(function(resolve,reject){ty.device.publishDps({deviceId:deviceId,mode:2,pipelines:[],options:{},dps:dpIds,success:function success(res){return resolve(res);},fail:function fail(e){return reject(e);}});});};exports.putDpData=putDpData;
package/lib/utils.js ADDED
@@ -0,0 +1,19 @@
1
+ import "core-js/modules/es.object.to-string.js";
2
+ import "core-js/modules/es.promise.js";
3
+ export var putDpData = function (dpIds, deviceId) {
4
+ return new Promise(function (resolve, reject) {
5
+ ty.device.publishDps({
6
+ deviceId: deviceId,
7
+ mode: 2,
8
+ pipelines: [],
9
+ options: {},
10
+ dps: dpIds,
11
+ success: function success(res) {
12
+ return resolve(res);
13
+ },
14
+ fail: function fail(e) {
15
+ return reject(e);
16
+ }
17
+ });
18
+ });
19
+ };
@@ -0,0 +1,19 @@
1
+ import "core-js/modules/es.object.to-string.js";
2
+ import "core-js/modules/es.promise.js";
3
+ export var putDpData = function (dpIds, deviceId) {
4
+ return new Promise(function (resolve, reject) {
5
+ ty.device.publishDps({
6
+ deviceId: deviceId,
7
+ mode: 2,
8
+ pipelines: [],
9
+ options: {},
10
+ dps: dpIds,
11
+ success: function success(res) {
12
+ return resolve(res);
13
+ },
14
+ fail: function fail(e) {
15
+ return reject(e);
16
+ }
17
+ });
18
+ });
19
+ };