@livekit/rtc-node 0.1.0 → 0.3.0-rc.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 (51) hide show
  1. package/dist/audio_stream.d.ts +4 -1
  2. package/dist/audio_stream.d.ts.map +1 -1
  3. package/dist/audio_stream.js +1 -1
  4. package/dist/audio_stream.js.map +1 -1
  5. package/dist/index.d.ts +4 -4
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +2 -2
  8. package/dist/index.js.map +1 -1
  9. package/dist/proto/audio_frame_pb.d.ts +0 -46
  10. package/dist/proto/audio_frame_pb.d.ts.map +1 -1
  11. package/dist/proto/audio_frame_pb.js +0 -70
  12. package/dist/proto/audio_frame_pb.js.map +1 -1
  13. package/dist/proto/ffi_pb.d.ts +31 -44
  14. package/dist/proto/ffi_pb.d.ts.map +1 -1
  15. package/dist/proto/ffi_pb.js +35 -10
  16. package/dist/proto/ffi_pb.js.map +1 -1
  17. package/dist/proto/room_pb.d.ts +5 -1
  18. package/dist/proto/room_pb.d.ts.map +1 -1
  19. package/dist/proto/room_pb.js +5 -0
  20. package/dist/proto/room_pb.js.map +1 -1
  21. package/dist/proto/video_frame_pb.d.ts +124 -390
  22. package/dist/proto/video_frame_pb.d.ts.map +1 -1
  23. package/dist/proto/video_frame_pb.js +149 -486
  24. package/dist/proto/video_frame_pb.js.map +1 -1
  25. package/dist/video_frame.d.ts +8 -102
  26. package/dist/video_frame.d.ts.map +1 -1
  27. package/dist/video_frame.js +157 -321
  28. package/dist/video_frame.js.map +1 -1
  29. package/dist/video_source.d.ts +2 -2
  30. package/dist/video_source.d.ts.map +1 -1
  31. package/dist/video_source.js +5 -10
  32. package/dist/video_source.js.map +1 -1
  33. package/dist/video_stream.d.ts +7 -2
  34. package/dist/video_stream.d.ts.map +1 -1
  35. package/dist/video_stream.js +5 -5
  36. package/dist/video_stream.js.map +1 -1
  37. package/package.json +6 -6
  38. package/src/audio_stream.ts +6 -2
  39. package/src/index.ts +3 -16
  40. package/src/proto/audio_frame_pb.ts +1 -91
  41. package/src/proto/e2ee_pb.ts +1 -1
  42. package/src/proto/ffi_pb.ts +55 -53
  43. package/src/proto/handle_pb.ts +1 -1
  44. package/src/proto/participant_pb.ts +1 -1
  45. package/src/proto/room_pb.ts +7 -1
  46. package/src/proto/stats_pb.ts +1 -1
  47. package/src/proto/track_pb.ts +1 -1
  48. package/src/proto/video_frame_pb.ts +186 -641
  49. package/src/video_frame.ts +179 -576
  50. package/src/video_source.ts +5 -9
  51. package/src/video_stream.ts +13 -6
@@ -8,6 +8,7 @@ import {
8
8
  CaptureVideoFrameResponse,
9
9
  NewVideoSourceRequest,
10
10
  NewVideoSourceResponse,
11
+ VideoRotation,
11
12
  VideoSourceInfo,
12
13
  VideoSourceType,
13
14
  } from './proto/video_frame_pb.js';
@@ -45,17 +46,12 @@ export class VideoSource {
45
46
  this.ffiHandle = new FfiHandle(res.source.handle.id);
46
47
  }
47
48
 
48
- captureFrame(frame: VideoFrame) {
49
+ captureFrame(frame: VideoFrame, timestampUs = 0n, rotation = VideoRotation.VIDEO_ROTATION_0) {
49
50
  let req = new CaptureVideoFrameRequest({
50
51
  sourceHandle: this.ffiHandle.handle,
51
- from: {
52
- case: 'info',
53
- value: frame.buffer.protoInfo(),
54
- },
55
- frame: {
56
- rotation: frame.rotation,
57
- timestampUs: BigInt(frame.timestampUs),
58
- },
52
+ buffer: frame.protoInfo(),
53
+ rotation,
54
+ timestampUs,
59
55
  });
60
56
 
61
57
  FfiClient.instance.request<CaptureVideoFrameResponse>({
@@ -6,16 +6,23 @@ import { FfiClient, FfiClientEvent, FfiEvent, FfiHandle, FfiRequest } from './ff
6
6
  import { Track } from './track.js';
7
7
  import EventEmitter from 'events';
8
8
  import TypedEmitter from 'typed-emitter';
9
- import { VideoFrame, VideoFrameBuffer } from './video_frame.js';
9
+ import { VideoFrame } from './video_frame.js';
10
10
  import {
11
11
  NewVideoStreamRequest,
12
12
  NewVideoStreamResponse,
13
+ VideoRotation,
13
14
  VideoStreamInfo,
14
15
  VideoStreamType,
15
16
  } from './proto/video_frame_pb.js';
16
17
 
18
+ export type VideoFrameEvent = {
19
+ frame: VideoFrame,
20
+ timestampUs: bigint,
21
+ rotation: VideoRotation,
22
+ }
23
+
17
24
  export type VideoStreamCallbacks = {
18
- frameReceived: (frame: VideoFrame) => void;
25
+ frameReceived: (evt: VideoFrameEvent) => void;
19
26
  };
20
27
 
21
28
  export enum VideoStreamEvent {
@@ -63,10 +70,10 @@ export class VideoStream extends (EventEmitter as new () => TypedEmitter<VideoSt
63
70
  let streamEvent = ev.message.value.message;
64
71
  switch (streamEvent.case) {
65
72
  case 'frameReceived':
66
- let frameInfo = streamEvent.value.frame;
67
- let buffer = VideoFrameBuffer.fromOwnedInfo(streamEvent.value.buffer);
68
- let frame = new VideoFrame(Number(frameInfo.timestampUs), frameInfo.rotation, buffer);
69
- this.emit(VideoStreamEvent.FrameReceived, frame);
73
+ let rotation = streamEvent.value.rotation;
74
+ let timestampUs = streamEvent.value.timestampUs;
75
+ let frame = VideoFrame.fromOwnedInfo(streamEvent.value.buffer);
76
+ this.emit(VideoStreamEvent.FrameReceived, { frame, timestampUs, rotation });
70
77
  break;
71
78
  case 'eos':
72
79
  FfiClient.instance.off(FfiClientEvent.FfiEvent, this.onEvent);