Not able to play stream using easy_onvif for ONVIF camera

40 Views Asked by At

I am building Flutter application that is supposed to display stream using a specified ONVIF IP address. However, for some reason my code is not working as expected;

import 'package:flutter/material.dart';
import 'package:flutter_vlc_player/flutter_vlc_player.dart';
import 'package:media_kit/media_kit.dart';
import 'package:onvifapp/landingpage/widgets/streamplayer_controller.dart';

class StreamPlayerGridItem extends StatefulWidget {
  final String ip;
  final String name;
  final String password;
  const StreamPlayerGridItem(
      {super.key,
      required this.ip,
      required this.name,
      required this.password});

  @override
  State<StreamPlayerGridItem> createState() => _StreamPlayerGridItemState();
}

StreamPlayerController _streamPlayerController = StreamPlayerController();

class _StreamPlayerGridItemState extends State<StreamPlayerGridItem> {
  late VlcPlayerController _videoPlayerController;

  

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    
        _videoPlayerController = VlcPlayerController.network(
        "rtsp://admin:[email protected]",
        hwAcc: HwAcc.full,
        autoPlay: true,
        options: VlcPlayerOptions(video: VlcVideoOptions(["options"])),
        
      
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: const EdgeInsets.all(10),
      decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(10),
          border: Border.all(color: Colors.black)),
      height: 200,
      width: 200,
      child: VlcPlayer(
        controller: _videoPlayerController,
        aspectRatio: 16 / 9,
        placeholder: const Center(child: CircularProgressIndicator()),
      ),
    );
  }
}

The error I am getting is

VLC is unable to open the MRL 'rtsp://admin:[email protected]/H.264/'. Check the log for details.

I have tried formatting URL in different ways but in vain. I expect it to show video stream, which is not happening. On the other hand, it is successfully showing stream when I use different URL (a demo camera) - i.e., rtsp://demo:[email protected]:16885/stream0

0

There are 0 best solutions below