@livekit/rtc-node 0.3.0 → 0.4.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 (70) hide show
  1. package/Cargo.toml +2 -1
  2. package/README.md +81 -0
  3. package/dist/audio_frame.d.ts +2 -1
  4. package/dist/audio_frame.d.ts.map +1 -1
  5. package/dist/audio_frame.js +3 -3
  6. package/dist/audio_frame.js.map +1 -1
  7. package/dist/audio_source.d.ts +2 -2
  8. package/dist/audio_source.d.ts.map +1 -1
  9. package/dist/audio_source.js +6 -9
  10. package/dist/audio_source.js.map +1 -1
  11. package/dist/audio_stream.d.ts +3 -3
  12. package/dist/audio_stream.d.ts.map +1 -1
  13. package/dist/audio_stream.js +6 -6
  14. package/dist/audio_stream.js.map +1 -1
  15. package/dist/e2ee.d.ts.map +1 -1
  16. package/dist/e2ee.js +16 -16
  17. package/dist/e2ee.js.map +1 -1
  18. package/dist/ffi_client.d.ts +3 -3
  19. package/dist/ffi_client.d.ts.map +1 -1
  20. package/dist/ffi_client.js +8 -11
  21. package/dist/ffi_client.js.map +1 -1
  22. package/dist/index.d.ts +1 -1
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +1 -1
  25. package/dist/index.js.map +1 -1
  26. package/dist/napi/native.js +1 -2
  27. package/dist/participant.d.ts +5 -4
  28. package/dist/participant.d.ts.map +1 -1
  29. package/dist/participant.js +15 -15
  30. package/dist/participant.js.map +1 -1
  31. package/dist/room.d.ts +25 -22
  32. package/dist/room.d.ts.map +1 -1
  33. package/dist/room.js +57 -55
  34. package/dist/room.js.map +1 -1
  35. package/dist/track.d.ts +3 -3
  36. package/dist/track.d.ts.map +1 -1
  37. package/dist/track.js +5 -8
  38. package/dist/track.js.map +1 -1
  39. package/dist/track_publication.d.ts +3 -3
  40. package/dist/track_publication.d.ts.map +1 -1
  41. package/dist/track_publication.js +1 -1
  42. package/dist/track_publication.js.map +1 -1
  43. package/dist/video_frame.d.ts +2 -1
  44. package/dist/video_frame.d.ts.map +1 -1
  45. package/dist/video_frame.js +1 -1
  46. package/dist/video_frame.js.map +1 -1
  47. package/dist/video_source.d.ts +3 -2
  48. package/dist/video_source.d.ts.map +1 -1
  49. package/dist/video_source.js +3 -3
  50. package/dist/video_source.js.map +1 -1
  51. package/dist/video_stream.d.ts +3 -3
  52. package/dist/video_stream.d.ts.map +1 -1
  53. package/dist/video_stream.js +8 -8
  54. package/dist/video_stream.js.map +1 -1
  55. package/package.json +9 -9
  56. package/src/audio_frame.ts +5 -5
  57. package/src/audio_source.ts +13 -14
  58. package/src/audio_stream.ts +13 -17
  59. package/src/e2ee.ts +25 -24
  60. package/src/ffi_client.ts +10 -11
  61. package/src/index.ts +1 -3
  62. package/src/napi/native.js +1 -2
  63. package/src/nodejs.rs +4 -2
  64. package/src/participant.ts +27 -29
  65. package/src/room.ts +93 -91
  66. package/src/track.ts +9 -11
  67. package/src/track_publication.ts +7 -7
  68. package/src/video_frame.ts +9 -16
  69. package/src/video_source.ts +10 -9
  70. package/src/video_stream.ts +17 -18
@@ -1,18 +1,19 @@
1
1
  // SPDX-FileCopyrightText: 2024 LiveKit, Inc.
2
2
  //
3
3
  // SPDX-License-Identifier: Apache-2.0
4
-
5
- import { FfiClient, FfiHandle, FfiRequest } from './ffi_client.js';
4
+ import { FfiClient, FfiHandle } from './ffi_client.js';
5
+ import type {
6
+ CaptureVideoFrameResponse,
7
+ NewVideoSourceResponse,
8
+ VideoSourceInfo,
9
+ } from './proto/video_frame_pb.js';
6
10
  import {
7
11
  CaptureVideoFrameRequest,
8
- CaptureVideoFrameResponse,
9
12
  NewVideoSourceRequest,
10
- NewVideoSourceResponse,
11
13
  VideoRotation,
12
- VideoSourceInfo,
13
14
  VideoSourceType,
14
15
  } from './proto/video_frame_pb.js';
15
- import { VideoFrame } from './video_frame.js';
16
+ import type { VideoFrame } from './video_frame.js';
16
17
 
17
18
  export class VideoSource {
18
19
  /** @internal */
@@ -27,7 +28,7 @@ export class VideoSource {
27
28
  this.width = width;
28
29
  this.height = height;
29
30
 
30
- let req = new NewVideoSourceRequest({
31
+ const req = new NewVideoSourceRequest({
31
32
  type: VideoSourceType.VIDEO_SOURCE_NATIVE,
32
33
  resolution: {
33
34
  width: width,
@@ -35,7 +36,7 @@ export class VideoSource {
35
36
  },
36
37
  });
37
38
 
38
- let res = FfiClient.instance.request<NewVideoSourceResponse>({
39
+ const res = FfiClient.instance.request<NewVideoSourceResponse>({
39
40
  message: {
40
41
  case: 'newVideoSource',
41
42
  value: req,
@@ -47,7 +48,7 @@ export class VideoSource {
47
48
  }
48
49
 
49
50
  captureFrame(frame: VideoFrame, timestampUs = 0n, rotation = VideoRotation.VIDEO_ROTATION_0) {
50
- let req = new CaptureVideoFrameRequest({
51
+ const req = new CaptureVideoFrameRequest({
51
52
  sourceHandle: this.ffiHandle.handle,
52
53
  buffer: frame.protoInfo(),
53
54
  rotation,
@@ -1,25 +1,24 @@
1
1
  // SPDX-FileCopyrightText: 2024 LiveKit, Inc.
2
2
  //
3
3
  // SPDX-License-Identifier: Apache-2.0
4
-
5
- import { FfiClient, FfiClientEvent, FfiEvent, FfiHandle, FfiRequest } from './ffi_client.js';
6
- import { Track } from './track.js';
7
4
  import EventEmitter from 'events';
8
- import TypedEmitter from 'typed-emitter';
9
- import { VideoFrame } from './video_frame.js';
10
- import {
11
- NewVideoStreamRequest,
5
+ import type TypedEmitter from 'typed-emitter';
6
+ import type { FfiEvent } from './ffi_client.js';
7
+ import { FfiClient, FfiClientEvent, FfiHandle } from './ffi_client.js';
8
+ import type {
12
9
  NewVideoStreamResponse,
13
10
  VideoRotation,
14
11
  VideoStreamInfo,
15
- VideoStreamType,
16
12
  } from './proto/video_frame_pb.js';
13
+ import { NewVideoStreamRequest, VideoStreamType } from './proto/video_frame_pb.js';
14
+ import type { Track } from './track.js';
15
+ import { VideoFrame } from './video_frame.js';
17
16
 
18
17
  export type VideoFrameEvent = {
19
- frame: VideoFrame,
20
- timestampUs: bigint,
21
- rotation: VideoRotation,
22
- }
18
+ frame: VideoFrame;
19
+ timestampUs: bigint;
20
+ rotation: VideoRotation;
21
+ };
23
22
 
24
23
  export type VideoStreamCallbacks = {
25
24
  frameReceived: (evt: VideoFrameEvent) => void;
@@ -41,12 +40,12 @@ export class VideoStream extends (EventEmitter as new () => TypedEmitter<VideoSt
41
40
  super();
42
41
  this.track = track;
43
42
 
44
- let req = new NewVideoStreamRequest({
43
+ const req = new NewVideoStreamRequest({
45
44
  type: VideoStreamType.VIDEO_STREAM_NATIVE,
46
45
  trackHandle: track.ffi_handle.handle,
47
46
  });
48
47
 
49
- let res = FfiClient.instance.request<NewVideoStreamResponse>({
48
+ const res = FfiClient.instance.request<NewVideoStreamResponse>({
50
49
  message: {
51
50
  case: 'newVideoStream',
52
51
  value: req,
@@ -67,12 +66,12 @@ export class VideoStream extends (EventEmitter as new () => TypedEmitter<VideoSt
67
66
  return;
68
67
  }
69
68
 
70
- let streamEvent = ev.message.value.message;
69
+ const streamEvent = ev.message.value.message;
71
70
  switch (streamEvent.case) {
72
71
  case 'frameReceived':
73
- let rotation = streamEvent.value.rotation;
74
- let timestampUs = streamEvent.value.timestampUs;
75
- let frame = VideoFrame.fromOwnedInfo(streamEvent.value.buffer);
72
+ const rotation = streamEvent.value.rotation;
73
+ const timestampUs = streamEvent.value.timestampUs;
74
+ const frame = VideoFrame.fromOwnedInfo(streamEvent.value.buffer);
76
75
  this.emit(VideoStreamEvent.FrameReceived, { frame, timestampUs, rotation });
77
76
  break;
78
77
  case 'eos':