react-native-webrtc-ar-session

0.1.3 • Public • Published

react-native-webrtc-ar-session

Capturing ARKit scene (Like react-native-arkit) into react-native-webrtc video stream.

Installation

  • Required use the react-native-webrtc patch. (You can use patch-package)
  • Add dependency with yarn add react-native-webrtc-ar-session
  • You may need to run react-native link react-native-webrtc-ar-session or autolinking.

Usage

After using this react-native-webrtc patch, we need to set ar: true in video property of mediaDevices.getUserMedia(...). (See the example)

import {
  isARWorldTrackingSupported,
  startCapturingARView,
  stopCapturingARView,
} from 'react-native-webrtc-ar-session'
 
// Check the device is support AR World Tracking
isARWorldTrackingSupported()
 
// Start capturing <ARKit /> view into WebRTC video stream
// You can call it after WebRTC and ARKit view is ready
startCapturingARView({
  frameRate: 30, // Default to ARSCNView.preferredFramesPerSecond (Default: 60)
}).then(({ success }) => console.log('Start session:', success))
 
stopCapturingARView()

Use another ARSCNView instead of react-native-arkit

You can have native ARSCNView setup without react-native-arkit:

// Add to your header file 
#import <RNWebRTCARSession/RNWebRTCARSession.h>
 
[RNWebRTCARSession setArView:__your_arscnview_here__];

Example

License

MIT

Package Sidebar

Install

npm i react-native-webrtc-ar-session

Weekly Downloads

3

Version

0.1.3

License

MIT

Unpacked Size

21.1 kB

Total Files

10

Last publish

Collaborators

  • jhen0409