Skip to content

Conversation

felire
Copy link

@felire felire commented Jun 12, 2025

What

This PR Adds the onBytesWrittenVideo callback in order to receive the bytes of the video while it is being recorded.

Changes

IOS

  • Implementing DispatchSourceTimer on Ios in order to read the file size from the FileSystem every 400 ms, that will be executed after the video has started and when finished the timer is cleaned.
  • Adding onBytesWrittenVideoEvent as RCTDirectEventBlock in order to send events to JS in RCTViewManager

Android

  • Creating BytesWrittenVideoEvent class
  • Adding onBytesWrittenVideo on the getExportedCustomDirectEventTypeConstants and all the logic to treat that as an Event and send data to JS
  • Send the data directly from VideoRecordEvent.Status as it is available there

TSX/TS

  • Adding types and JS Docs
  • Adding the onBytesWrittenVideo and destructuring the NativeEvent to just expose (bytes: number) => void

Docs

  • Add an example on video page

Tested on

  • iPhone 8
  • Samsung Galaxy S24 FE

Related issues

Copy link

vercel bot commented Jun 12, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-native-vision-camera ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 12, 2025 1:23am

@mrousavy
Copy link
Owner

cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants