QuickNV.HikvisionISUPSDK.Api 1.0.1

dotnet add package QuickNV.HikvisionISUPSDK.Api --version 1.0.1
NuGet\Install-Package QuickNV.HikvisionISUPSDK.Api -Version 1.0.1
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="QuickNV.HikvisionISUPSDK.Api" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add QuickNV.HikvisionISUPSDK.Api --version 1.0.1
#r "nuget: QuickNV.HikvisionISUPSDK.Api, 1.0.1"
#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 QuickNV.HikvisionISUPSDK.Api as a Cake Addin
#addin nuget:?package=QuickNV.HikvisionISUPSDK.Api&version=1.0.1

// Install QuickNV.HikvisionISUPSDK.Api as a Cake Tool
#tool nuget:?package=QuickNV.HikvisionISUPSDK.Api&version=1.0.1

QuickNV.HikvisionISUPSDK

  • Avaliable as nuget

  • NuGet Downloads

  • QuickNV.HikvisionISUPSDK.

说明

SDK定义类:QuickNV.HikvisionISUPSDK.Defines
SDK方法类:QuickNV.HikvisionISUPSDK.Methods
SDK错误枚举:QuickNV.HikvisionISUPSDK.Errors

示例

using QuickNV.HikvisionISUPSDK.Api;
using QuickNV.HikvisionISUPSDK.Api.Rtp;
using Newtonsoft.Json;

var zlmServerIpAddress = "127.0.0.1";
var zlmServerRtpPort = 10000;
var smsServerIpAddrss = "127.0.0.1";

var rtpSender = new TcpRtpSender(new RtpSenderOptions()
{
    Host = zlmServerIpAddress,
    Port = zlmServerRtpPort,
    SSRC = 0x12345678
});

CmsContext.Init();
SmsContext.Init();

var cmsOptions = new CmsContextOptions()
{
    ListenIPAddress = "0.0.0.0",
    ListenPort = 7660
};
var smsOptions = new SmsContextOptions()
{
    ListenIPAddress = "0.0.0.0",
    ListenPort = 7760,
    LinkMode = SmsLinkMode.UDP
};

var cmsContext = new CmsContext(cmsOptions);
cmsContext.DeviceOnline += Context_DeviceOnline;
cmsContext.DeviceOffline += Context_DeviceOffline;

var smsContext = new SmsContext(smsOptions);
smsContext.PreviewNewlink += SmsContext_PreviewNewlink;
smsContext.PreviewData += SmsContext_PreviewData;

void SmsContext_PreviewNewlink(object? sender, SmsContextPreviewNewlinkEventArgs e)
{
    Console.WriteLine($"[SMS]新预览连接:" + JsonConvert.SerializeObject(e, Formatting.Indented));
    var mediaId = (int)e.SessionId;
    Console.WriteLine($"[SMS]DeviceSerial:{e.DeviceSerial},Channel:{e.ChannelId},MediaId:{mediaId},StreamFormat:{e.StreamFormat},StreamType:{e.StreamType}");
}

void SmsContext_PreviewData(object? sender, SmsContextPreviewDataEventArgs e)
{
    var dataSpan = e.GetDataSpan();
    rtpSender.Write(dataSpan);
}

void Context_DeviceOffline(object? sender, DeviceContext e)
{
    Console.WriteLine("[CMS]设备下线!" + JsonConvert.SerializeObject(e, Formatting.Indented));
}

void Context_DeviceOnline(object? sender, DeviceContext e)
{
    Console.WriteLine("[CMS]设备上线!" + JsonConvert.SerializeObject(e, Formatting.Indented));
    try
    {
        var streamId = e.StartGetRealStreamV11(smsServerIpAddrss, smsOptions.ListenPort, 1, SmsLinkMode.UDP, SmsStreamType.Sub);
        Console.WriteLine("[CMS]StreamId:" + streamId);
        rtpSender.Connect();
        e.StartPushRealStream(streamId);
    }
    catch (Exception ex)
    {
        Console.WriteLine("发起推流失败。" + ex.ToString());
    }
}

Console.WriteLine($"正在启动SMS...");
smsContext.Start();
Console.WriteLine($"SMS启动完成。监听端点:{smsOptions.ListenIPAddress}:{smsOptions.ListenPort}");
Console.WriteLine($"正在启动CMS...");
cmsContext.Start();
Console.WriteLine($"CMS启动完成。监听端点:{cmsOptions.ListenIPAddress}:{cmsOptions.ListenPort}");
Console.ReadLine();
Console.WriteLine($"正在停止CMS...");
cmsContext.Stop();
Console.WriteLine($"CMS已停止.");
Console.WriteLine($"正在停止SMS...");
smsContext.Stop();
Console.WriteLine($"SMS已停止.");
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 was computed.  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.0.1 458 9/28/2023
1.0.0 595 8/30/2023