@livekit/rtc-node 0.0.1 → 0.0.3

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 (74) hide show
  1. package/dist/audio_frame.d.ts +13 -0
  2. package/dist/audio_frame.js +36 -0
  3. package/dist/audio_frame.js.map +1 -0
  4. package/dist/audio_source.d.ts +13 -0
  5. package/dist/audio_source.js +42 -0
  6. package/dist/audio_source.js.map +1 -0
  7. package/dist/audio_stream.d.ts +23 -0
  8. package/dist/audio_stream.js +54 -0
  9. package/dist/audio_stream.js.map +1 -0
  10. package/dist/e2ee.d.ts +43 -0
  11. package/dist/e2ee.js +232 -0
  12. package/dist/e2ee.js.map +1 -0
  13. package/dist/ffi_client.d.ts +22 -0
  14. package/dist/ffi_client.js +57 -0
  15. package/dist/ffi_client.js.map +1 -0
  16. package/dist/index.d.ts +15 -0
  17. package/dist/index.js +71 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/native.d.ts +5 -0
  20. package/dist/native.js +297 -0
  21. package/dist/native.js.map +1 -0
  22. package/dist/participant.d.ts +29 -0
  23. package/dist/participant.js +120 -0
  24. package/dist/participant.js.map +1 -0
  25. package/dist/proto/audio_frame_pb.d.ts +555 -0
  26. package/dist/proto/audio_frame_pb.js +861 -0
  27. package/dist/proto/audio_frame_pb.js.map +1 -0
  28. package/dist/proto/e2ee_pb.d.ts +651 -0
  29. package/dist/proto/e2ee_pb.js +906 -0
  30. package/dist/proto/e2ee_pb.js.map +1 -0
  31. package/dist/proto/ffi_pb.d.ts +671 -0
  32. package/dist/proto/ffi_pb.js +459 -0
  33. package/dist/proto/ffi_pb.js.map +1 -0
  34. package/dist/proto/handle_pb.d.ts +29 -0
  35. package/dist/proto/handle_pb.js +59 -0
  36. package/dist/proto/handle_pb.js.map +1 -0
  37. package/dist/proto/participant_pb.d.ts +53 -0
  38. package/dist/proto/participant_pb.js +93 -0
  39. package/dist/proto/participant_pb.js.map +1 -0
  40. package/dist/proto/room_pb.d.ts +1479 -0
  41. package/dist/proto/room_pb.js +2172 -0
  42. package/dist/proto/room_pb.js.map +1 -0
  43. package/dist/proto/stats_pb.d.ts +1712 -0
  44. package/dist/proto/stats_pb.js +2238 -0
  45. package/dist/proto/stats_pb.js.map +1 -0
  46. package/dist/proto/track_pb.d.ts +352 -0
  47. package/dist/proto/track_pb.js +550 -0
  48. package/dist/proto/track_pb.js.map +1 -0
  49. package/dist/proto/video_frame_pb.d.ts +854 -0
  50. package/dist/proto/video_frame_pb.js +1214 -0
  51. package/dist/proto/video_frame_pb.js.map +1 -0
  52. package/dist/room.d.ts +94 -0
  53. package/dist/room.js +285 -0
  54. package/dist/room.js.map +1 -0
  55. package/dist/track.d.ts +34 -0
  56. package/dist/track.js +72 -0
  57. package/dist/track.js.map +1 -0
  58. package/dist/track_publication.d.ts +30 -0
  59. package/dist/track_publication.js +66 -0
  60. package/dist/track_publication.js.map +1 -0
  61. package/dist/video_frame.d.ts +110 -0
  62. package/dist/video_frame.js +364 -0
  63. package/dist/video_frame.js.map +1 -0
  64. package/dist/video_source.d.ts +13 -0
  65. package/dist/video_source.js +44 -0
  66. package/dist/video_source.js.map +1 -0
  67. package/dist/video_stream.d.ts +23 -0
  68. package/dist/video_stream.js +56 -0
  69. package/dist/video_stream.js.map +1 -0
  70. package/package.json +18 -10
  71. package/src/native.js +25 -0
  72. package/.prettierrc +0 -7
  73. package/generate_proto.sh +0 -34
  74. package/tsconfig.json +0 -14
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.VideoStream = exports.VideoStreamEvent = void 0;
7
+ const ffi_client_1 = require("./ffi_client");
8
+ const events_1 = __importDefault(require("events"));
9
+ const video_frame_1 = require("./video_frame");
10
+ const video_frame_pb_1 = require("./proto/video_frame_pb");
11
+ var VideoStreamEvent;
12
+ (function (VideoStreamEvent) {
13
+ VideoStreamEvent["FrameReceived"] = "frameReceived";
14
+ })(VideoStreamEvent || (exports.VideoStreamEvent = VideoStreamEvent = {}));
15
+ class VideoStream extends events_1.default {
16
+ constructor(track) {
17
+ super();
18
+ this.track = track;
19
+ let req = new video_frame_pb_1.NewVideoStreamRequest({
20
+ type: video_frame_pb_1.VideoStreamType.VIDEO_STREAM_NATIVE,
21
+ trackHandle: track.ffi_handle.handle,
22
+ });
23
+ let res = ffi_client_1.FfiClient.instance.request({
24
+ message: {
25
+ case: 'newVideoStream',
26
+ value: req,
27
+ },
28
+ });
29
+ this.info = res.stream.info;
30
+ this.ffiHandle = new ffi_client_1.FfiHandle(res.stream.handle.id);
31
+ ffi_client_1.FfiClient.instance.on(ffi_client_1.FfiClientEvent.FfiEvent, this.onEvent);
32
+ }
33
+ onEvent(ev) {
34
+ if (ev.message.case != 'videoStreamEvent' ||
35
+ ev.message.value.streamHandle != this.ffiHandle.handle) {
36
+ return;
37
+ }
38
+ let streamEvent = ev.message.value.message;
39
+ switch (streamEvent.case) {
40
+ case 'frameReceived':
41
+ let frameInfo = streamEvent.value.frame;
42
+ let buffer = video_frame_1.VideoFrameBuffer.fromOwnedInfo(streamEvent.value.buffer);
43
+ let frame = new video_frame_1.VideoFrame(Number(frameInfo.timestampUs), frameInfo.rotation, buffer);
44
+ this.emit(VideoStreamEvent.FrameReceived, frame);
45
+ break;
46
+ case 'eos':
47
+ ffi_client_1.FfiClient.instance.off(ffi_client_1.FfiClientEvent.FfiEvent, this.onEvent);
48
+ break;
49
+ }
50
+ }
51
+ close() {
52
+ this.ffiHandle.dispose();
53
+ }
54
+ }
55
+ exports.VideoStream = VideoStream;
56
+ //# sourceMappingURL=video_stream.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video_stream.js","sourceRoot":"","sources":["../src/video_stream.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA0F;AAE1F,oDAAkC;AAElC,+CAA6D;AAC7D,2DAKgC;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AM,GAAG,8BAAgB,CAAC,aAAa,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;gBACtE,IAAI,KAAK,GAAG,IAAI,wBAAU,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;gBACtF,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;gBACjD,MAAM;YACR,KAAK,KAAK;gBACR,sBAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,2BAAc,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;gBAC9D,MAAM;QACV,CAAC;IACH,CAAC;IAED,KAAK;QACH,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;CACF;AAvDD,kCAuDC"}
package/package.json CHANGED
@@ -1,8 +1,17 @@
1
1
  {
2
2
  "name": "@livekit/rtc-node",
3
- "version": "0.0.1",
4
- "main": "lib/index.js",
5
- "types": "src/index.ts",
3
+ "description": "LiveKit RTC Node",
4
+ "license": "Apache-2.0",
5
+ "version": "0.0.3",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist",
10
+ "src",
11
+ "build.rs",
12
+ "Cargo.toml",
13
+ "Cargo.lock"
14
+ ],
6
15
  "napi": {
7
16
  "name": "rtc-node",
8
17
  "triples": {
@@ -16,7 +25,6 @@
16
25
  ]
17
26
  }
18
27
  },
19
- "license": "Apache-2.0",
20
28
  "dependencies": {
21
29
  "@bufbuild/protobuf": "^1.4.2"
22
30
  },
@@ -31,7 +39,7 @@
31
39
  "node": ">= 10"
32
40
  },
33
41
  "scripts": {
34
- "artifacts": "napi artifacts",
42
+ "artifacts": "tsc && napi artifacts",
35
43
  "build": "tsc && napi build --platform --release --dts src/native.d.ts --js src/native.js --pipe \"prettier -w\"",
36
44
  "build:debug": "napi build --platform",
37
45
  "prepublishOnly": "napi prepublish -t npm",
@@ -39,10 +47,10 @@
39
47
  "version": "napi version"
40
48
  },
41
49
  "optionalDependencies": {
42
- "@livekit/rtc-node-darwin-arm64": "0.0.1",
43
- "@livekit/rtc-node-darwin-x64": "0.0.1",
44
- "@livekit/rtc-node-linux-arm64-gnu": "0.0.1",
45
- "@livekit/rtc-node-linux-x64-gnu": "0.0.1",
46
- "@livekit/rtc-node-win32-x64-msvc": "0.0.1"
50
+ "@livekit/rtc-node-darwin-arm64": "0.0.3",
51
+ "@livekit/rtc-node-darwin-x64": "0.0.3",
52
+ "@livekit/rtc-node-linux-arm64-gnu": "0.0.3",
53
+ "@livekit/rtc-node-linux-x64-gnu": "0.0.3",
54
+ "@livekit/rtc-node-win32-x64-msvc": "0.0.3"
47
55
  }
48
56
  }
package/src/native.js CHANGED
@@ -219,6 +219,31 @@ switch (platform) {
219
219
  loadError = e;
220
220
  }
221
221
  break;
222
+ case 'riscv64':
223
+ if (isMusl()) {
224
+ localFileExisted = existsSync(join(__dirname, 'rtc-node.linux-riscv64-musl.node'));
225
+ try {
226
+ if (localFileExisted) {
227
+ nativeBinding = require('./rtc-node.linux-riscv64-musl.node');
228
+ } else {
229
+ nativeBinding = require('@livekit/rtc-node-linux-riscv64-musl');
230
+ }
231
+ } catch (e) {
232
+ loadError = e;
233
+ }
234
+ } else {
235
+ localFileExisted = existsSync(join(__dirname, 'rtc-node.linux-riscv64-gnu.node'));
236
+ try {
237
+ if (localFileExisted) {
238
+ nativeBinding = require('./rtc-node.linux-riscv64-gnu.node');
239
+ } else {
240
+ nativeBinding = require('@livekit/rtc-node-linux-riscv64-gnu');
241
+ }
242
+ } catch (e) {
243
+ loadError = e;
244
+ }
245
+ }
246
+ break;
222
247
  default:
223
248
  throw new Error(`Unsupported architecture on Linux: ${arch}`);
224
249
  }
package/.prettierrc DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "singleQuote": true,
3
- "trailingComma": "all",
4
- "semi": true,
5
- "tabWidth": 2,
6
- "printWidth": 100,
7
- }
package/generate_proto.sh DELETED
@@ -1,34 +0,0 @@
1
- #!/bin/bash
2
- # Copyright 2023 LiveKit, Inc.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- # This script requires protobuf-compiler and https://github.com/nipunn1313/mypy-protobuf
16
-
17
- FFI_PROTOCOL=./rust-sdks/livekit-ffi/protocol
18
- FFI_OUT_NODE=./src/proto
19
-
20
- # ffi
21
-
22
- protoc \
23
- -I=$FFI_PROTOCOL \
24
- --es_out $FFI_OUT_NODE \
25
- --es_opt target=ts \
26
- $FFI_PROTOCOL/audio_frame.proto \
27
- $FFI_PROTOCOL/ffi.proto \
28
- $FFI_PROTOCOL/handle.proto \
29
- $FFI_PROTOCOL/participant.proto \
30
- $FFI_PROTOCOL/room.proto \
31
- $FFI_PROTOCOL/track.proto \
32
- $FFI_PROTOCOL/video_frame.proto \
33
- $FFI_PROTOCOL/e2ee.proto \
34
- $FFI_PROTOCOL/stats.proto
package/tsconfig.json DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "module": "commonjs",
4
- "esModuleInterop": true,
5
- "allowJs": true,
6
- "declaration": true,
7
- "target": "es2020",
8
- "lib": ["es2020"],
9
- "moduleResolution": "node",
10
- "sourceMap": true,
11
- "outDir": "lib"
12
- },
13
- "include": ["src/**/*"]
14
- }