@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.
- package/Cargo.toml +2 -1
- package/README.md +81 -0
- package/dist/audio_frame.d.ts +2 -1
- package/dist/audio_frame.d.ts.map +1 -1
- package/dist/audio_frame.js +3 -3
- package/dist/audio_frame.js.map +1 -1
- package/dist/audio_source.d.ts +2 -2
- package/dist/audio_source.d.ts.map +1 -1
- package/dist/audio_source.js +6 -9
- package/dist/audio_source.js.map +1 -1
- package/dist/audio_stream.d.ts +3 -3
- package/dist/audio_stream.d.ts.map +1 -1
- package/dist/audio_stream.js +6 -6
- package/dist/audio_stream.js.map +1 -1
- package/dist/e2ee.d.ts.map +1 -1
- package/dist/e2ee.js +16 -16
- package/dist/e2ee.js.map +1 -1
- package/dist/ffi_client.d.ts +3 -3
- package/dist/ffi_client.d.ts.map +1 -1
- package/dist/ffi_client.js +8 -11
- package/dist/ffi_client.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/napi/native.js +1 -2
- package/dist/participant.d.ts +5 -4
- package/dist/participant.d.ts.map +1 -1
- package/dist/participant.js +15 -15
- package/dist/participant.js.map +1 -1
- package/dist/room.d.ts +25 -22
- package/dist/room.d.ts.map +1 -1
- package/dist/room.js +57 -55
- package/dist/room.js.map +1 -1
- package/dist/track.d.ts +3 -3
- package/dist/track.d.ts.map +1 -1
- package/dist/track.js +5 -8
- package/dist/track.js.map +1 -1
- package/dist/track_publication.d.ts +3 -3
- package/dist/track_publication.d.ts.map +1 -1
- package/dist/track_publication.js +1 -1
- package/dist/track_publication.js.map +1 -1
- package/dist/video_frame.d.ts +2 -1
- package/dist/video_frame.d.ts.map +1 -1
- package/dist/video_frame.js +1 -1
- package/dist/video_frame.js.map +1 -1
- package/dist/video_source.d.ts +3 -2
- package/dist/video_source.d.ts.map +1 -1
- package/dist/video_source.js +3 -3
- package/dist/video_source.js.map +1 -1
- package/dist/video_stream.d.ts +3 -3
- package/dist/video_stream.d.ts.map +1 -1
- package/dist/video_stream.js +8 -8
- package/dist/video_stream.js.map +1 -1
- package/package.json +9 -9
- package/src/audio_frame.ts +5 -5
- package/src/audio_source.ts +13 -14
- package/src/audio_stream.ts +13 -17
- package/src/e2ee.ts +25 -24
- package/src/ffi_client.ts +10 -11
- package/src/index.ts +1 -3
- package/src/napi/native.js +1 -2
- package/src/nodejs.rs +4 -2
- package/src/participant.ts +27 -29
- package/src/room.ts +93 -91
- package/src/track.ts +9 -11
- package/src/track_publication.ts +7 -7
- package/src/video_frame.ts +9 -16
- package/src/video_source.ts +10 -9
- package/src/video_stream.ts +17 -18
package/src/video_source.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2024 LiveKit, Inc.
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
|
|
5
|
-
import {
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
51
|
+
const req = new CaptureVideoFrameRequest({
|
|
51
52
|
sourceHandle: this.ffiHandle.handle,
|
|
52
53
|
buffer: frame.protoInfo(),
|
|
53
54
|
rotation,
|
package/src/video_stream.ts
CHANGED
|
@@ -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 {
|
|
10
|
-
import {
|
|
11
|
-
|
|
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
|
-
|
|
43
|
+
const req = new NewVideoStreamRequest({
|
|
45
44
|
type: VideoStreamType.VIDEO_STREAM_NATIVE,
|
|
46
45
|
trackHandle: track.ffi_handle.handle,
|
|
47
46
|
});
|
|
48
47
|
|
|
49
|
-
|
|
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
|
-
|
|
69
|
+
const streamEvent = ev.message.value.message;
|
|
71
70
|
switch (streamEvent.case) {
|
|
72
71
|
case 'frameReceived':
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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':
|