Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[feature] Add Stream API for capturing video frames from WebRTC MediaStreamTrack

Đang mở
#670 5 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
dart, flutter
Lĩnh vực
audio-video-rtc, mobile

Hướng nghiên cứu

Start by reading the existing Timer-based captureFrame() usage and the RemoteRehabilitationRoomState reference in the issue, then investigate how this SDK exposes native WebRTC frame callbacks on each platform. Define what the stream emits and how frames are managed across platforms; done means a stream delivers frames at the native rate without Timer polling. The issue names no test files.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Is your feature request related to a problem? Please describe.
Currently, when trying to analyze video frames from WebRTC MediaStreamTrack in real-time (e.g., for ML processing), we need to use Timer to periodically capture frames using captureFrame(). This approach has several issues:

  • High CPU/Memory usage
  • UI stuttering
  • Potential frame drops
  • Inconsistent frame rate
    Describe the solution you'd like
    Add a new Stream-based API to capture video frames from MediaStreamTrack that:
  1. Provides frames as a Stream at the native frame rate
  2. Integrates directly with the native WebRTC frame callback system
  3. Has an API similar to:
Stream<VideoFrame> getVideoFrameStream() async {
// Implementation that hooks into native frame callbacks
}

This would allow more efficient frame processing without Timer polling.
Describe alternatives you've considered

  1. Current Timer-based approach with captureFrame()
  2. Custom native implementation per platform
  3. Using platform channels with event streams

The Stream API would be the most elegant and performant solution.

Additional context
Looking at the current implementation in the codebase:

  1. The current implementation uses Timer-based approach:
  captureImageTimer = Timer.periodic(
   const Duration(milliseconds: 200),
  () async {
    if (!mounted) return;
    await caputureImage(videoTrack);
   },
);

  Future<Image> captureImage({
    required VideoTrack videoTrack,
  }) async {
    try {
      final mediaStreamTrack = videoTrack.mediaStreamTrack;

      final imageByteBuffer = await mediaStreamTrack.captureFrame();

      final imageBytes = imageByteBuffer.asUint8List();

      final image = await compute(
        decodeImage,
        imageBytes,
      );
      return image;
  }
  1. The proposed Stream API could be integrated with the existing RemoteRehabilitationRoomState class, replacing the current Timer implementation:
Stream<VideoFrame> getVideoFrameStream() async {
// Implementation using native frame callbacks
}
  1. Benefits of this approach:
  • More efficient resource usage
  • Better frame timing accuracy
  • Native integration with WebRTC frame callbacks
  • Reduced CPU/Memory overhead
  • Smoother integration with ML processing pipeline

/cc @cloudwebrtc

Ngôn ngữ chính
Dart
Star
421
Fork
260
Merge trung bình
3 ngày 9 giờ
Pull request đã merge (30 ngày)
11

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của livekit/client-sdk-flutter

Tất cả issue của livekit/client-sdk-flutter

Issue tương tự

Thêm issue về Dart

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.