Live
import React, { Component } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import Camera from 'react-native-camera';
import ObjectDetectionCamera from 'react-native-vision-camera';
export default class App extends Component {
state = {
rtspUrl: 'rtsp://your_rtsp_url'
}
handleObjectsDetected = objects => {
console.log(objects);
}
render() {
return (
<View style={styles.container}>
<ObjectDetectionCamera
style={styles.preview}
uri={this.state.rtspUrl}
onObjectDetected={this.handleObjectsDetected}
/>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
backgroundColor: 'black'
},
preview: {
flex: 1,
justifyContent: 'flex-end',
alignItems: 'center'
}
});
Comments
Post a Comment