搜索插件、代码仓与 APP 分类

插件详情v1.0.1

mjpeg_stream

一个用于通过 HTTP 流式传输 MJPEG(运动 JPEG)视频的 Flutter 包

AndroidiOSmacOSWindowsLinux
近 30 天下载
112
喜欢数
3
Pub 分数
125

安装插件

flutter pub add mjpeg_stream

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

mjpeg_stream 包使 Flutter 应用程序能够通过 HTTP 流式传输 MJPEG(运动 JPEG)视频,为来自 IP 摄像头或网络服务器的实时视频播放提供轻量级解决方案。它支持 Android、iOS、macOS、Windows 和 Linux 等多个平台,非常适合跨平台视频监控应用。该包以极低延迟高效处理 HTTP 流媒体,使开发者能够将实时视频流直接集成到其用户界面中。在需要连续视频流的监控、机器人和物联网应用中尤为有用。

适合场景

  • 实时摄像头监控
  • 物联网设备视频流集成
  • 机器人视觉系统
  • 监控仪表板
  • 远程诊断

主要特点

  • 支持通过HTTP的MJPEG
  • 跨平台兼容性
  • 低延迟流媒体
  • 与 Flutter 小部件的简单集成
  • 实时视频播放

适合对象

  • 开发监控应用程序的开发者
  • 物联网项目创建者
  • 机器人工程师
  • 需要实时视频流的应用程序
  • 跨平台视频解决方案

使用建议

  • 需要稳定的网络连接
  • 限制为 MJPEG 格式
  • 可能需要额外的缓冲区以应对低带宽
  • 不适用于高分辨率视频流
  • 依赖服务器端的MJPEG流媒体支持

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

📸 MJPEG Stream Flutter Package

mjpegLogo1

Welcome to MJPEG Stream Flutter Package! 🚀 This package allows you to stream MJPEG video in your Flutter application easily. Perfect for real-time camera feeds and IP camera streaming. 📷🎥

https://github.com/user-attachments/assets/c908688e-3cd0-45bc-a21b-359df1eac6a5

screen4

screen3

🌟 Features

  • 📡 Live MJPEG streaming
  • 🎨 Customizable width, height, and fit
  • ⚡ Optimized for performance
  • 🚀 Easy to integrate
  • 🛠 Error handling and reconnection support
  • 📜 Built-in logging for debugging

📦 Installation

Run this command:

With Flutter:

flutter pub add mjpeg_stream

Add this package to your pubspec.yaml:

dependencies:
  mjpeg_stream: latest_version

OR

mjpeg_stream:
    git:  
      url: https://github.com/MohammedShamseerPV/MJPEG-Stream.git
      ref: main  # Optional: specify the branch (default is 'main')

Then, run:

flutter pub get

🛠 Usage

Import the package:

import 'package:mjpeg_stream/mjpeg_stream.dart';
Example Usage 🎬
import 'package:flutter/material.dart';
import 'package:mjpeg_stream/mjpeg_stream.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'MJPEG Stream Example',
      home: Scaffold(
        appBar: AppBar(title: Text("MJPEG Stream")),
        body: Center(
          child: MJPEGStreamScreen(
            streamUrl: "http://your-ip-camera-url/video.mjpg",
            width: 300.0,
            height: 200.0,
            fit: BoxFit.cover,
          ),
        ),
      ),
    );
  }
}

📚 Use this Package as a Library

📥 Depend on it

Run this command:

With Flutter:

flutter pub add mjpeg_stream

This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):

dependedfdfdfncies:
  mjpeg_stream: ^latest_version
dependencies:
  mjpeg_stream: ^latest_version

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

📌 Import it

Now in your Dart code, you can use:

import 'package:mjpeg_stream/mjpeg_stream.dart';

⚙️ API Reference

Property Type Description
streamUrl String The URL of the MJPEG stream.
fit BoxFit Defines how the image should be inscribed into the widget. Default: BoxFit.cover.
width double Width of the stream display. Default: double.infinity.
height double Height of the stream display. Default: 300.0.
timeout Duration Timeout for the network request. Default: 5 seconds.
enableLogging bool Enables logging for debugging. Default: false.

🚀 How It Works

  1. The package establishes an HTTP connection to the MJPEG stream.
  2. It processes the received image frames in real-time.
  3. It updates the UI efficiently without performance issues.
  4. It handles errors and reconnection automatically. ⚡
  5. It provides logging for debugging purposes. 📜

🛠 Troubleshooting

  • ❗ Stream Not Loading? Check if your URL is correct and accessible.
  • 🔴 Slow Performance? Optimize the network or use a lower resolution stream.
  • 💥 Crashes? Ensure the stream URL is reachable and error handling is implemented.
  • 📝 Need Debugging? Enable logging by setting enableLogging: true.

🎯 Future Enhancements

  • ✅ Add support for pause/play functionality
  • ✅ Improve error handling
  • ✅ Optimize performance for low-latency streaming
  • ✅ Enhance logging and debugging features

📝 License

This package is open-source under the MIT License. Feel free to contribute! 😊

👨‍💻 Happy Coding! 🚀


🔗 Connect with Me


💰 Support My Work

If you found this package useful, consider supporting my work:

qr-code-phonePay

Uploading qr-code-phonePay.png…

所属分类

依赖

依赖清单 1 项

源码仓库

使用此插件的项目

暂无相关数据。