2

I am using flutter video_player plugin for camera video streaming. Camera streaming is from ESP32Cam hardware.

ESP32Cam is streaming video on network using http protocol and in mjpeg format

Verified in VLC media player, Codec information are as below:

Codec: Motion JPEG Video (MJPG)

Decoded format: Planar 4:2:2 YUV full scale

What are the configuration required in video_player plugin to stream the video?

Here is my flutter code for streaming initialization:

late VideoPlayerController _controller;
 _controller = VideoPlayerController.network(
    //'https://www.sample-videos.com/video123/mp4/720/big_buck_bunny_720p_20mb.mp4'
     "http://192.168.216.40",
    // formatHint: VideoFormat.hls,
    )
..initialize().then((_) {
  print("Streaming initialized...");
  // Ensure the first frame is shown after the video is initialized, even before the play button has been pressed.
});

Then I am using widget in my Container widget

Container(
    child: VideoPlayer(_controller),
),

ESP32Cam setup for reference link

Krunal Sonparate
  • 1,122
  • 10
  • 29

2 Answers2

0

you can use live streaming pluging without null safety: https://pub.dev/packages/mjpeg

with null safety: https://pub.dev/packages/flutter_mjpeg

Muhammad Kashif
  • 253
  • 3
  • 6
0

You can use the above comment's plug-in in the pubspec.yaml file and do the following steps

  1. Add new dummy variable bool isRunning = true; in State<YourStateName>

  2. put dummy variable in Mjpeg[isLive] -> child: Mjpeg(isLive: isRunning, stream: 'replace with your local streaming URL')

you can use this link for more information https://youtu.be/2OjO6K5QuYs

tanindy
  • 1
  • 2