@livekit/rtc-node 0.0.1 → 0.0.2
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/package.json +11 -7
- package/.prettierrc +0 -7
- package/Cargo.toml +0 -21
- package/build.rs +0 -5
- package/generate_proto.sh +0 -34
- package/src/audio_frame.ts +0 -45
- package/src/audio_source.ts +0 -64
- package/src/audio_stream.ts +0 -74
- package/src/e2ee.ts +0 -311
- package/src/ffi_client.ts +0 -68
- package/src/index.ts +0 -52
- package/src/lib.rs +0 -5
- package/src/native.d.ts +0 -14
- package/src/native.js +0 -244
- package/src/nodejs.rs +0 -115
- package/src/participant.ts +0 -171
- package/src/proto/audio_frame_pb.ts +0 -1121
- package/src/proto/e2ee_pb.ts +0 -1231
- package/src/proto/ffi_pb.ts +0 -969
- package/src/proto/handle_pb.ts +0 -69
- package/src/proto/participant_pb.ts +0 -121
- package/src/proto/room_pb.ts +0 -2843
- package/src/proto/stats_pb.ts +0 -2955
- package/src/proto/track_pb.ts +0 -683
- package/src/proto/video_frame_pb.ts +0 -1568
- package/src/room.ts +0 -370
- package/src/track.ts +0 -101
- package/src/track_publication.ts +0 -90
- package/src/video_frame.ts +0 -620
- package/src/video_source.ts +0 -61
- package/src/video_stream.ts +0 -76
- package/tsconfig.json +0 -14
package/src/video_stream.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { FfiClient, FfiClientEvent, FfiEvent, FfiHandle, FfiRequest } from './ffi_client';
|
|
2
|
-
import { Track } from './track';
|
|
3
|
-
import EventEmitter from 'events';
|
|
4
|
-
import TypedEmitter from 'typed-emitter';
|
|
5
|
-
import { VideoFrame, VideoFrameBuffer } from './video_frame';
|
|
6
|
-
import {
|
|
7
|
-
NewVideoStreamRequest,
|
|
8
|
-
NewVideoStreamResponse,
|
|
9
|
-
VideoStreamInfo,
|
|
10
|
-
VideoStreamType,
|
|
11
|
-
} from './proto/video_frame_pb';
|
|
12
|
-
|
|
13
|
-
export type VideoStreamCallbacks = {
|
|
14
|
-
frameReceived: (frame: VideoFrame) => void;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export enum VideoStreamEvent {
|
|
18
|
-
FrameReceived = 'frameReceived',
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export class VideoStream extends (EventEmitter as new () => TypedEmitter<VideoStreamCallbacks>) {
|
|
22
|
-
/** @internal */
|
|
23
|
-
info: VideoStreamInfo;
|
|
24
|
-
/** @internal */
|
|
25
|
-
ffiHandle: FfiHandle;
|
|
26
|
-
|
|
27
|
-
track: Track;
|
|
28
|
-
|
|
29
|
-
constructor(track: Track) {
|
|
30
|
-
super();
|
|
31
|
-
this.track = track;
|
|
32
|
-
|
|
33
|
-
let req = new NewVideoStreamRequest({
|
|
34
|
-
type: VideoStreamType.VIDEO_STREAM_NATIVE,
|
|
35
|
-
trackHandle: track.ffi_handle.handle,
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
let res = FfiClient.instance.request<NewVideoStreamResponse>({
|
|
39
|
-
message: {
|
|
40
|
-
case: 'newVideoStream',
|
|
41
|
-
value: req,
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
this.info = res.stream.info;
|
|
46
|
-
this.ffiHandle = new FfiHandle(res.stream.handle.id);
|
|
47
|
-
|
|
48
|
-
FfiClient.instance.on(FfiClientEvent.FfiEvent, this.onEvent);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
private onEvent(ev: FfiEvent) {
|
|
52
|
-
if (
|
|
53
|
-
ev.message.case != 'videoStreamEvent' ||
|
|
54
|
-
ev.message.value.streamHandle != this.ffiHandle.handle
|
|
55
|
-
) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
let streamEvent = ev.message.value.message;
|
|
60
|
-
switch (streamEvent.case) {
|
|
61
|
-
case 'frameReceived':
|
|
62
|
-
let frameInfo = streamEvent.value.frame;
|
|
63
|
-
let buffer = VideoFrameBuffer.fromOwnedInfo(streamEvent.value.buffer);
|
|
64
|
-
let frame = new VideoFrame(Number(frameInfo.timestampUs), frameInfo.rotation, buffer);
|
|
65
|
-
this.emit(VideoStreamEvent.FrameReceived, frame);
|
|
66
|
-
break;
|
|
67
|
-
case 'eos':
|
|
68
|
-
FfiClient.instance.off(FfiClientEvent.FfiEvent, this.onEvent);
|
|
69
|
-
break;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
close() {
|
|
74
|
-
this.ffiHandle.dispose();
|
|
75
|
-
}
|
|
76
|
-
}
|
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
|
-
}
|