am trying to connect an Inskam camera to my Flutter application and display its video feed. I’ve been using the wifi_iot
package for Wi-Fi connectivity and the video_player
package to display the video. Despite my efforts, the app fails to connect to the camera’s Wi-Fi or display the video feed correctly.
import 'package:flutter/material.dart';
import 'package:video_player/video_player.dart';
import 'package:wifi_iot/wifi_iot.dart';
import 'camera_service.dart'; // Assuming this is a custom service you've created
import 'package:permission_handler/permission_handler.dart';
class CameraExample2 extends StatefulWidget {
@override
_CameraExample2State createState() => _CameraExample2State();
}
class _CameraExample2State extends State<CameraExample2> {
VideoPlayerController? _controller;
Future<void>? _initializeVideoPlayerFuture;
final CameraService _cameraService = CameraService('192.168.100.41'); // Replace with your camera's IP address
bool _isConnected = false;
String _statusMessage = 'Connecting to Wi-Fi...';
@override
void initState() {
super.initState();
_connectToWifi();
}
Future<void> _connectToWifi() async {
try {
// Request location permission
if (await Permission.location.request().isGranted) {
// Replace with your camera's Wi-Fi SSID and password
const ssid = 'inskam-FC10E16';
const password = '12345678';
// Enable Wi-Fi if it's not enabled
bool wifiEnabled = await WiFiForIoTPlugin.isEnabled();
print('Wi-Fi enabled: $wifiEnabled');
if (!wifiEnabled) {
await WiFiForIoTPlugin.setEnabled(true);
print('Wi-Fi has been enabled');
}
// Check available Wi-Fi networks (for debugging purposes)
var wifiNetworks = await WiFiForI
i tried using the wifi manager but there are no results