0.1.3 • Published 4 years ago

react-native-webrtc-ar-session v0.1.3

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

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