@camera.ui/camera-ui-tuya 0.0.19 → 0.0.21

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/bundle.zip ADDED
Binary file
package/package.json CHANGED
@@ -1,52 +1,30 @@
1
1
  {
2
2
  "displayName": "Tuya",
3
3
  "name": "@camera.ui/camera-ui-tuya",
4
- "version": "0.0.19",
4
+ "version": "0.0.21",
5
5
  "description": "camera.ui tuya plugin",
6
6
  "author": "seydx (https://github.com/seydx/camera.ui)",
7
7
  "main": "./dist/index.js",
8
- "type": "module",
8
+ "type": "commonjs",
9
9
  "scripts": {
10
10
  "build": "rimraf dist && tsc",
11
- "format": "prettier --write 'src/' --ignore-unknown --no-error-on-unmatched-pattern",
12
- "lint": "eslint --fix --ext .js,.ts .",
13
- "update": "updates --update ./",
11
+ "bundle": "npm run format && npm run lint && npm run build && cui bundle",
12
+ "format": "prettier --write \"src/\" --ignore-unknown --no-error-on-unmatched-pattern",
14
13
  "install-updates": "npm i --save",
15
- "prepublishOnly": "npm i --package-lock-only && npm run lint && npm run format && npm run build"
16
- },
17
- "dependencies": {
18
- "@camera.ui/rtsp": "^0.0.40",
19
- "axios": "^0.27.2",
20
- "crypto-js": "^4.2.0",
21
- "mqtt": "^5.10.1",
22
- "mqtt-packet": "^9.0.0",
23
- "rxjs": "^7.8.1",
24
- "werift": "^0.20.0",
25
- "ws": "^8.18.0"
26
- },
27
- "devDependencies": {
28
- "@camera.ui/types": "^0.0.77",
29
- "@rushstack/eslint-patch": "^1.10.4",
30
- "@types/crypto-js": "^4.2.2",
31
- "@types/node": "^22.7.6",
32
- "@types/ws": "^8.5.12",
33
- "@typescript-eslint/eslint-plugin": "^8.10.0",
34
- "@typescript-eslint/parser": "^8.10.0",
35
- "concurrently": "^9.0.1",
36
- "eslint": "8.57.0",
37
- "eslint-config-prettier": "^9.1.0",
38
- "eslint-plugin-prettier": "^5.2.1",
39
- "prettier": "^3.3.3",
40
- "rimraf": "^6.0.1",
41
- "typescript": "^5.6.3",
42
- "updates": "^16.4.0"
14
+ "lint": "eslint .",
15
+ "lint:fix": "eslint --fix .",
16
+ "prepublishOnly": "node -e \"if(!process.env.SAFE_PUBLISH){console.error('Error: Please use @camera.ui/cli to publish the plugin:\\n npm run publish:alpha\\n npm run publish:beta\\n npm run publish:latest\\n');process.exit(1)}\"",
17
+ "publish:alpha": "cui publish --alpha",
18
+ "publish:beta": "cui publish --beta",
19
+ "publish:latest": "cui publish --latest",
20
+ "update": "updates --update ./"
43
21
  },
44
22
  "bugs": {
45
23
  "url": "https://github.com/seydx/camera.ui/issues"
46
24
  },
47
25
  "engines": {
48
- "camera.ui": ">=0.0.34-alpha.2",
49
- "node": ">=20.17.0"
26
+ "camera.ui": ">=0.0.34-alpha.4",
27
+ "node": ">=20.18.0"
50
28
  },
51
29
  "homepage": "https://github.com/seydx/camera.ui#readme",
52
30
  "keywords": [
@@ -66,6 +44,7 @@
66
44
  "dependencies": [],
67
45
  "options": {
68
46
  "extendedMotionDetection": false
69
- }
47
+ },
48
+ "bundled": true
70
49
  }
71
- }
50
+ }
package/CHANGELOG.md DELETED
@@ -1,8 +0,0 @@
1
- All notable changes to this project will be documented in this file.
2
-
3
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
4
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
-
6
- ## [X.X.X] - ???
7
-
8
- - Initial Release
package/CONTRIBUTING.md DELETED
@@ -1 +0,0 @@
1
- # Contributing
package/LICENSE.md DELETED
@@ -1,22 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2023-2024 seydx <dev@seydx.com>
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md DELETED
@@ -1 +0,0 @@
1
- # @camera.ui/camera-ui-tuya
@@ -1,296 +0,0 @@
1
- {
2
- "schema": {
3
- "home": {
4
- "type": "object",
5
- "title": "Tuya Account",
6
- "description": "Tuya Account",
7
- "required": true,
8
- "opened": true,
9
- "properties": {
10
- "userId": {
11
- "type": "string",
12
- "title": "User ID",
13
- "description": "You can find this information in Tuya IoT > Cloud > Devices > Linked Devices",
14
- "required": true,
15
- "store": true
16
- },
17
- "accessId": {
18
- "type": "string",
19
- "title": "Access ID",
20
- "description": "This is localted on the main project",
21
- "format": "password",
22
- "required": true,
23
- "store": true
24
- },
25
- "accessKey": {
26
- "type": "string",
27
- "title": "Access Key/Secret",
28
- "description": "This is localted on the main project",
29
- "format": "password",
30
- "required": true,
31
- "store": true
32
- },
33
- "country": {
34
- "type": "string",
35
- "title": "Country",
36
- "description": "This is the country where you registered your devices",
37
- "required": false,
38
- "store": true,
39
- "defaultValue": "United States of America",
40
- "enum": [
41
- "Afghanistan",
42
- "Albania",
43
- "Algeria",
44
- "American Samoa",
45
- "Andorra",
46
- "Angola",
47
- "Anguilla",
48
- "Antarctica",
49
- "Antigua and Barbuda",
50
- "Argentina",
51
- "Armenia",
52
- "Aruba",
53
- "Australia",
54
- "Austria",
55
- "Azerbaijan",
56
- "Bahamas",
57
- "Bahrain",
58
- "Bangladesh",
59
- "Barbados",
60
- "Belarus",
61
- "Belgium",
62
- "Belize",
63
- "Benin",
64
- "Bermuda",
65
- "Bhutan",
66
- "Bolivia",
67
- "Bosnia and Herzegovina",
68
- "Botswana",
69
- "Brazil",
70
- "British Indian Ocean Territory",
71
- "British Virgin Islands",
72
- "Brunei",
73
- "Bulgaria",
74
- "Burkina Faso",
75
- "Burundi",
76
- "Cabo Verde",
77
- "Cambodia",
78
- "Cameroon",
79
- "Canada",
80
- "Cayman Islands",
81
- "Central African Republic",
82
- "Chad",
83
- "Chile",
84
- "China",
85
- "Colombia",
86
- "Comoros",
87
- "Cook Islands",
88
- "Costa Rica",
89
- "Croatia",
90
- "Curacao",
91
- "Cyprus",
92
- "Czech Republic",
93
- "Côte d'Ivoire",
94
- "Democratic Republic of the Congo",
95
- "Denmark",
96
- "Djibouti",
97
- "Dominica",
98
- "Dominican Republic (1-809)",
99
- "Dominican Republic (1-829)",
100
- "Dominican Republic (1-849)",
101
- "East Timor",
102
- "Ecuador",
103
- "Egypt",
104
- "El Salvador",
105
- "Equatorial Guinea",
106
- "Eritrea",
107
- "Estonia",
108
- "Ethiopia",
109
- "Falkland Islands",
110
- "Faroe Islands",
111
- "Fiji",
112
- "Finland",
113
- "France",
114
- "French Guiana",
115
- "French Polynesia",
116
- "Gabon",
117
- "Gambia",
118
- "Georgia",
119
- "Germany",
120
- "Ghana",
121
- "Gibraltar",
122
- "Greece",
123
- "Greenland",
124
- "Grenada",
125
- "Guam",
126
- "Guatemala",
127
- "Guinea",
128
- "Guinea-Bissau",
129
- "Guyana",
130
- "Haiti",
131
- "Honduras",
132
- "Hong Kong",
133
- "Hungary",
134
- "Iceland",
135
- "India",
136
- "Indonesia",
137
- "Iraq",
138
- "Ireland",
139
- "Israel",
140
- "Italy",
141
- "Jamaica",
142
- "Japan",
143
- "Jordan",
144
- "Kenya",
145
- "Kiribati",
146
- "Kuwait",
147
- "Kyrgyzstan",
148
- "Laos",
149
- "Latvia",
150
- "Lebanon",
151
- "Lesotho",
152
- "Liberia",
153
- "Libya",
154
- "Liechtenstein",
155
- "Lithuania",
156
- "Luxembourg",
157
- "Macao",
158
- "Macedonia",
159
- "Madagascar",
160
- "Malawi",
161
- "Malaysia",
162
- "Maldives",
163
- "Mali",
164
- "Malta",
165
- "Marshall Islands",
166
- "Martinique",
167
- "Mauritania",
168
- "Mauritius",
169
- "Mayotte",
170
- "Mexico",
171
- "Micronesia",
172
- "Moldova",
173
- "Monaco",
174
- "Mongolia",
175
- "Montenegro",
176
- "Montserrat",
177
- "Morocco",
178
- "Mozambique",
179
- "Myanmar",
180
- "Namibia",
181
- "Nauru",
182
- "Nepal",
183
- "Netherlands",
184
- "New Caledonia",
185
- "New Zealand",
186
- "Nicaragua",
187
- "Niger",
188
- "Nigeria",
189
- "Niue",
190
- "Northern Mariana Islands",
191
- "Norway",
192
- "Oman",
193
- "Pakistan",
194
- "Palau",
195
- "Palestine",
196
- "Panama",
197
- "Papua New Guinea",
198
- "Paraguay",
199
- "Peru",
200
- "Philippines",
201
- "Poland",
202
- "Portugal",
203
- "Puerto Rico",
204
- "Qatar",
205
- "Republic of the Congo",
206
- "Reunion",
207
- "Romania",
208
- "Russia",
209
- "Rwanda",
210
- "Saint Kitts and Nevis",
211
- "Saint Lucia",
212
- "Saint Martin",
213
- "Saint Pierre and Miquelon",
214
- "Saint Vincent and the Grenadines",
215
- "Samoa",
216
- "San Marino",
217
- "Saudi Arabia",
218
- "Sao Tome and Principe",
219
- "Senegal",
220
- "Serbia",
221
- "Seychelles",
222
- "Sierra Leone",
223
- "Singapore",
224
- "Sint Maarten",
225
- "Slovakia",
226
- "Slovenia",
227
- "Solomon Islands",
228
- "Somalia",
229
- "South Africa",
230
- "South Korea",
231
- "Spain",
232
- "Sri Lanka",
233
- "Suriname",
234
- "Swalbard and Jan Mayen",
235
- "Swaziland",
236
- "Sweden",
237
- "Switzerland",
238
- "Taiwan",
239
- "Tajikistan",
240
- "Tanzania",
241
- "Thailand",
242
- "Togo",
243
- "Tokelau",
244
- "Tonga",
245
- "Trinidad and Tobago",
246
- "Tunisia",
247
- "Turkey",
248
- "Turkmenistan",
249
- "Turks and Caicos Islands",
250
- "Tuvalu",
251
- "United States of America",
252
- "U.S. Virgin Islands",
253
- "Uganda",
254
- "Ukraine",
255
- "United Arab Emirates",
256
- "United Kingdom",
257
- "Uruguay",
258
- "Uzbekistan",
259
- "Vanuatu",
260
- "Vatican",
261
- "Venezuela",
262
- "Vietnam",
263
- "Wallis and Futuna",
264
- "Western Sahara",
265
- "Yemen",
266
- "Zambia",
267
- "Zimbabwe",
268
- "Åland Islands"
269
- ]
270
- },
271
- "useWebRTC": {
272
- "type": "boolean",
273
- "title": "Use WebRTC",
274
- "description": "Use WebRTC to stream video from the camera",
275
- "required": false,
276
- "store": true,
277
- "defaultValue": false
278
- },
279
- "homeWhitelist": {
280
- "type": "array",
281
- "title": "Home Whitelist",
282
- "description": "An array of integer values for the home IDs you want to whitelist. If provided, only devices with matching Home IDs will be included",
283
- "required": false,
284
- "items": {
285
- "type": "string",
286
- "title": "Home ID",
287
- "description": "The Home ID of the device"
288
- },
289
- "defaultValue": [],
290
- "store": true,
291
- "opened": true
292
- }
293
- }
294
- }
295
- }
296
- }
package/dist/camera.d.ts DELETED
@@ -1,34 +0,0 @@
1
- import { WebRTCReceiver } from '@camera.ui/rtsp';
2
- import type { AnswerSDP } from '@camera.ui/rtsp';
3
- import type { CameraDelegate, CameraDevice, LoggerService } from '@camera.ui/types';
4
- import type { RTCIceCandidate } from 'werift';
5
- import type Tuya from './index.js';
6
- import type { TuyaCloud } from './tuya/cloud.js';
7
- import type { TuyaDeviceConfig } from './tuya/const.js';
8
- export declare class Camera extends WebRTCReceiver implements CameraDelegate {
9
- cameraDevice: CameraDevice;
10
- cloudCamera: TuyaDeviceConfig;
11
- private platform;
12
- private cloud;
13
- private logger;
14
- private cameraLogger;
15
- private ffmpegPath?;
16
- private pc?;
17
- private rtspServer;
18
- private motionTimeout?;
19
- private binaryTimeout?;
20
- private previousDoorbellRing?;
21
- private previousMotion?;
22
- constructor(platform: Tuya, cloud: TuyaCloud, cloudCamera: TuyaDeviceConfig, logger: LoggerService);
23
- createCameraDevice(): Promise<void>;
24
- onOffer(offerSdp: string): Promise<AnswerSDP>;
25
- onCandidate(candidate: RTCIceCandidate): Promise<void>;
26
- snapshot(): Promise<ArrayBuffer | undefined>;
27
- reboot(): Promise<void>;
28
- updateState(): void;
29
- private triggerBinaryState;
30
- private triggerMotion;
31
- private createRTSPServer;
32
- private createPeerCoonection;
33
- private toBool;
34
- }
package/dist/camera.js DELETED
@@ -1,243 +0,0 @@
1
- import { RTSPSingleServer, WebRTCReceiver } from '@camera.ui/rtsp';
2
- import { MediaStreamTrack, RTCPeerConnection, RTCRtpCodecParameters, RTCSessionDescription } from 'werift';
3
- import { CustomPeerConnection } from './peer.js';
4
- import { TuyaDevice } from './tuya/device.js';
5
- export class Camera extends WebRTCReceiver {
6
- cameraDevice;
7
- cloudCamera;
8
- platform;
9
- cloud;
10
- logger;
11
- cameraLogger;
12
- ffmpegPath;
13
- pc;
14
- rtspServer;
15
- motionTimeout;
16
- binaryTimeout;
17
- previousDoorbellRing;
18
- previousMotion;
19
- constructor(platform, cloud, cloudCamera, logger) {
20
- super();
21
- this.platform = platform;
22
- this.cloud = cloud;
23
- this.cloudCamera = cloudCamera;
24
- this.logger = logger;
25
- this.cameraLogger = logger;
26
- }
27
- async createCameraDevice() {
28
- await this.createRTSPServer();
29
- const sourceName = 'P2P';
30
- const streamUrls = [this.rtspServer.streamUrl];
31
- const cameraDevice = Array.from(this.platform.cameras.values()).find((camera) => camera.nativeId === this.cloudCamera.id);
32
- if (!cameraDevice) {
33
- this.logger.log('Adding camera', this.cloudCamera.name);
34
- this.cameraDevice = await this.platform.api.deviceManager.createCamera({
35
- name: this.cloudCamera.name,
36
- nativeId: this.cloudCamera.id,
37
- hasBinarySensor: TuyaDevice.isDoorbell(this.cloudCamera),
38
- hasLight: TuyaDevice.hasLightSwitch(this.cloudCamera),
39
- info: {
40
- manufacturer: 'Tuya',
41
- model: this.cloudCamera.model,
42
- serialNumber: this.cloudCamera.id,
43
- supportUrl: 'https://support.tuya.com/en/help',
44
- },
45
- sources: [
46
- {
47
- name: sourceName,
48
- roles: ['high-resolution', 'snapshot'],
49
- urls: streamUrls,
50
- },
51
- ],
52
- });
53
- }
54
- else {
55
- this.cameraDevice = cameraDevice;
56
- await this.cameraDevice.updateCameraSource(cameraDevice.streamSource._id, { urls: streamUrls });
57
- }
58
- this.cameraLogger = this.cameraDevice.logger;
59
- this.cameraDevice.setDelegate('cameraDelegate', this);
60
- const ffmpegPath = await this.platform.api.coreManager.getFFmpegPath();
61
- this.rtspServer.changeFFmpegPath(ffmpegPath);
62
- await this.cameraDevice.connect();
63
- }
64
- async onOffer(offerSdp) {
65
- this.cameraLogger.debug('Preparing stream...');
66
- let timeout;
67
- const cleanup = () => {
68
- clearTimeout(timeout);
69
- tuyaPeerConnection.onAudioRtcp.unsubscribe();
70
- tuyaPeerConnection.onVideoRtcp.unsubscribe();
71
- tuyaPeerConnection.onIceCandidate.unsubscribe();
72
- tuyaPeerConnection.close();
73
- pc.connectionStateChange.allUnsubscribe();
74
- pc.onTrack.allUnsubscribe();
75
- pc.close();
76
- this.cameraLogger.debug('Stream stopped!');
77
- };
78
- const tuyaPeerConnection = new CustomPeerConnection(this.platform, this.cameraDevice, this.cloudCamera);
79
- tuyaPeerConnection.createPeerConnection();
80
- const audioTrack = new MediaStreamTrack({ kind: 'audio' });
81
- const videoTrack = new MediaStreamTrack({ kind: 'video' });
82
- tuyaPeerConnection.onAudioRtp.subscribe((rtp) => {
83
- audioTrack.writeRtp(rtp);
84
- });
85
- tuyaPeerConnection.onVideoRtp.subscribe((rtp) => {
86
- videoTrack.writeRtp(rtp);
87
- });
88
- const pc = (this.pc = this.createPeerCoonection());
89
- pc.onIceCandidate.subscribe((candidate) => {
90
- if (candidate) {
91
- this.events.emit('candidate', candidate);
92
- }
93
- });
94
- pc.connectionStateChange.subscribe((ev) => {
95
- this.cameraLogger.debug(`connectionStateChange: ${ev}`);
96
- if (ev === 'disconnected' || ev === 'failed' || ev === 'closed') {
97
- cleanup();
98
- }
99
- if (ev === 'connecting') {
100
- timeout = setTimeout(() => {
101
- this.cameraLogger.warn('Connection timeout!');
102
- cleanup();
103
- }, 10000);
104
- }
105
- if (ev === 'connected') {
106
- this.cameraLogger.log('Stream started!');
107
- clearTimeout(timeout);
108
- }
109
- });
110
- pc.onTrack.subscribe((track) => {
111
- if (track.kind === 'audio') {
112
- track.onReceiveRtp.subscribe((rtp) => {
113
- tuyaPeerConnection.returnAudioTrack.writeRtp(rtp);
114
- });
115
- }
116
- });
117
- pc.addTransceiver(videoTrack, { direction: 'sendonly' });
118
- pc.addTransceiver(audioTrack, { direction: 'sendonly' });
119
- const offer = new RTCSessionDescription(offerSdp, 'offer');
120
- await pc.setRemoteDescription(offer);
121
- const answer = await pc.createAnswer();
122
- await pc.setLocalDescription(answer);
123
- return answer.sdp;
124
- }
125
- async onCandidate(candidate) {
126
- await this.pc?.addIceCandidate(candidate);
127
- }
128
- async snapshot() {
129
- return;
130
- }
131
- async reboot() {
132
- return;
133
- }
134
- updateState() {
135
- if (TuyaDevice.hasMotionDetection(this.cloudCamera)) {
136
- const motionDetectedStatus = TuyaDevice.getMotionDetectionStatus(this.cloudCamera);
137
- if (motionDetectedStatus) {
138
- if (!this.previousMotion) {
139
- this.previousMotion = motionDetectedStatus.value;
140
- }
141
- else if (this.previousMotion !== motionDetectedStatus.value) {
142
- this.previousMotion = motionDetectedStatus.value;
143
- this.triggerMotion();
144
- }
145
- }
146
- }
147
- if (TuyaDevice.isDoorbell(this.cloudCamera)) {
148
- const doorbellRingStatus = TuyaDevice.getDoorbellRing(this.cloudCamera);
149
- if (doorbellRingStatus) {
150
- if (!this.previousDoorbellRing) {
151
- this.previousDoorbellRing = doorbellRingStatus.value;
152
- }
153
- else if (this.previousDoorbellRing !== doorbellRingStatus.value) {
154
- this.previousDoorbellRing = doorbellRingStatus.value;
155
- this.triggerBinaryState();
156
- }
157
- }
158
- }
159
- if (TuyaDevice.hasLightSwitch(this.cloudCamera)) {
160
- const state = TuyaDevice.getLightSwitchStatus(this.cloudCamera)?.value;
161
- this.cameraDevice.updateState('light', { state: this.toBool(state) });
162
- }
163
- }
164
- triggerBinaryState() {
165
- clearTimeout(this.binaryTimeout);
166
- this.cameraDevice.updateState('doorbell', { state: true });
167
- this.binaryTimeout = setTimeout(() => {
168
- this.cameraDevice.updateState('doorbell', { state: false });
169
- }, 10 * 1000);
170
- }
171
- triggerMotion() {
172
- const timeoutCallback = () => {
173
- this.cameraDevice.updateState('motion', { state: false, detections: [] });
174
- this.motionTimeout = undefined;
175
- };
176
- if (!this.motionTimeout) {
177
- this.motionTimeout = setTimeout(timeoutCallback, 10 * 1000);
178
- this.cameraDevice.updateState('motion', { state: true, detections: [] });
179
- }
180
- else {
181
- // Cancel the timeout and start again.
182
- clearTimeout(this.motionTimeout);
183
- this.motionTimeout = setTimeout(timeoutCallback, 10 * 1000);
184
- }
185
- }
186
- async createRTSPServer() {
187
- const webrtcStreamConfig = {
188
- name: 'Tuya',
189
- receiver: this,
190
- addBackchannel: true,
191
- };
192
- const rtspStreamConfig = {
193
- name: 'Tuya',
194
- url: async () => {
195
- const rtsps = await this.platform.cloud?.getRTSPS(this.cloudCamera);
196
- if (!rtsps) {
197
- throw new Error(`Failed to capture stream for ${this.cloudCamera.name}: RTSPS link not found.`);
198
- }
199
- return rtsps.url;
200
- },
201
- };
202
- const rtspLogger = {
203
- // log: this.cameraLogger.log.bind(this.logger),
204
- warn: this.cameraLogger.warn.bind(this.logger),
205
- error: this.cameraLogger.error.bind(this.logger),
206
- // debug: this.cameraLogger.trace.bind(this.logger),
207
- };
208
- const stream = this.platform.config.home.useWebRTC ? webrtcStreamConfig : rtspStreamConfig;
209
- this.rtspServer = await RTSPSingleServer.initialize({ stream }, rtspLogger);
210
- await this.rtspServer.listen();
211
- }
212
- createPeerCoonection() {
213
- return new RTCPeerConnection({
214
- codecs: {
215
- video: [
216
- new RTCRtpCodecParameters({
217
- mimeType: 'video/H264',
218
- clockRate: 90000,
219
- payloadType: 96,
220
- rtcpFeedback: [{ type: 'transport-cc' }, { type: 'ccm', parameter: 'fir' }, { type: 'nack' }, { type: 'nack', parameter: 'pli' }, { type: 'goog-remb' }],
221
- parameters: 'level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f',
222
- }),
223
- ],
224
- audio: [
225
- new RTCRtpCodecParameters({
226
- mimeType: 'audio/PCMU',
227
- clockRate: 8000,
228
- channels: 1,
229
- payloadType: 0,
230
- }),
231
- ],
232
- },
233
- bundlePolicy: 'max-bundle',
234
- });
235
- }
236
- toBool(value) {
237
- if (typeof value === 'string' && value.toLowerCase() === 'false') {
238
- return false;
239
- }
240
- return !!value;
241
- }
242
- }
243
- //# sourceMappingURL=camera.js.map