react native streaming with react-native-streaming
import React, { Component } from 'react';
import { View } from 'react-native';
import { RTSPView } from 'react-native-streaming';
class CameraScreen extends Component {
render() {
return (
<View style={{ flex: 1 }}>
<RTSPView
style={{ flex: 1 }}
url="rtsp://192.168.1.16/video" // Replace with your IP camera's RTSP URL
ref={(ref) => {
this.rtsvp = ref;
}}
onConnectionSuccess={() => {
console.log('RTSP connection successful');
}}
onConnectionFailed={() => {
console.log('RTSP connection failed');
}}
onReady={() => {
console.log('RTSP stream ready');
}}
onVideoEnd={() => {
console.log('RTSP stream ended');
}}
onError={(err) => {
console.log('RTSP error: ', err);
}}
/>
</View>
);
}
}
export default CameraScreen;
Comments
Post a Comment