Mjpeg.Provider.NET 1.1.0

dotnet add package Mjpeg.Provider.NET --version 1.1.0                
NuGet\Install-Package Mjpeg.Provider.NET -Version 1.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Mjpeg.Provider.NET" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Mjpeg.Provider.NET --version 1.1.0                
#r "nuget: Mjpeg.Provider.NET, 1.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Mjpeg.Provider.NET as a Cake Addin
#addin nuget:?package=Mjpeg.Provider.NET&version=1.1.0

// Install Mjpeg.Provider.NET as a Cake Tool
#tool nuget:?package=Mjpeg.Provider.NET&version=1.1.0                

Mjpeg.Provider.NET

This package can help us convert images to MJPEG Stream and push to browser or application.

How to use

  1. Dependency injection
    # Parameter 1: Set the image format of the image data.
    # Parameter 2: The default picture position, if the user pulls a stream that does not exist, this picture will be displayed.
    services.AddAdvancedMJPEGProvider(PixelFormat.BGR, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Images", "NoSignal.jpg"));
    
  2. Create a Controller to provide users with streaming
    [Route("api/[controller]")]
    [ApiController]
    public class LiveViewController : ControllerBase
    {
        private readonly MjpegProvider provider;
    
        public LiveViewController(MjpegProvider provider)
            => this.provider = provider;
    
        /// <summary>
        /// https://localhost:5001/api/LiveView/Stream?Id=15d07bca-864a-48cc-9c48-6c1734e09f49&fps=15&longSize=720&drawBoundingBox=true
        /// </summary>
        /// <param name="Id"> Stream id </param>
        /// <param name="fps"> Output fps </param>
        /// <param name="longSize"> Set the longest side for equal scaling </param>
        /// <param name="drawBoundingBox"> Whether to draw a bounding box </param>
        /// <returns></returns>
        [HttpGet]
        [Route("Stream")]
        public IActionResult Stream(Guid Id, int fps = 15, int longSize = default, bool drawBoundingBox = false)
            => provider.GetMJPEGActionResult(Id, fps, longSize, drawBoundingBox);
    
  3. Push stream
    private readonly AdvancedMJPEGProvider advancedMJPEGProvider;
    
    a. Create a streaming channel
    # Parameter 1: Stream Id
    advancedMJPEGProvider.CreateChannel(Id);
    
    b. start inserting image
    # Parameter 1: Stream Id
    # Parameter 2: byte array, Pixel data
    # Parameter 3: int, Width
    # Parameter 4: int, Height
    advancedMJPEGProvider.UpdateChannelImage(Id, imageData, width, height);
    
    c. delete streaming channel
    # Parameter 1: Stream Id
    advancedMJPEGProvider.RemoveChannel(Id);
    
    d. Reset streaming image to default
    # Parameter 1: Stream Id
    advancedMJPEGProvider.SetDefaultImage(Id);
    
  4. Setting bounding box
    # Parameter 1: Color: new Color(R, G, B), fill in the value of rgb
    # parameter 2: brush width
    # Parameter 3: The coordinate set of the line: new PointF(X, Y)
    public record BoundinxBox(Color Color, float Thickness, PointF[] Points);
    
    b. Set the Bounding box of streaming
    # Parameter 1: Stream Id
    # Parameter 2: IEnumerable<BoundingBox>, a collection of BoundingBox
    advancedMJPEGProvider.SetBoundingBox(Id, boundingBoxInfos);
    
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 51,835 12/4/2022
1.0.0 1,115 6/11/2022