Com.Netease.LiveVCloud.AspNetCore
1.0.10
dotnet add package Com.Netease.LiveVCloud.AspNetCore --version 1.0.10
NuGet\Install-Package Com.Netease.LiveVCloud.AspNetCore -Version 1.0.10
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="Com.Netease.LiveVCloud.AspNetCore" Version="1.0.10" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Com.Netease.LiveVCloud.AspNetCore --version 1.0.10
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Com.Netease.LiveVCloud.AspNetCore, 1.0.10"
#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 Com.Netease.LiveVCloud.AspNetCore as a Cake Addin
#addin nuget:?package=Com.Netease.LiveVCloud.AspNetCore&version=1.0.10
// Install Com.Netease.LiveVCloud.AspNetCore as a Cake Tool
#tool nuget:?package=Com.Netease.LiveVCloud.AspNetCore&version=1.0.10
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
网易云信直播 SDK
简介
通过查阅网易云信官方文档:https://doc.yunxin.163.com/, 基于网易云信直播 Restful API 编写的直播 SDK, 注册到Asp.Net Core DI容器,利用IHttpClientFactory管理HttpClient的生命周期, 详细功能介绍请查看:https://doc.yunxin.163.com/jEyODA1OTE/docs/zkzMDA3NTU, 源代码仓库地址:https://gitee.com/tanwucheng/Com.Netease.VCloud.Core.git
使用示例
// Program.cs启动文件注册
using Com.Netease.LiveVCloud.AspNetCore;
var builder = WebApplication.CreateBuilder(args);
// 其他代码 省略...
// 注册LiveVCloudClient
var appKey = "???";
var appSecret = "???";
builder.Services.AddNeteaseLiveVCloudClient(options =>
{
options.AppKey = appKey;
options.AppSecret = appSecret;
});
// 其他代码 省略...
app.Run();
// 控制器注入使用
/// <summary>
/// 网易云信直播数据接口
/// </summary>
[ApiController]
[Route("[controller]")]
public class LiveVCloudController : ControllerBase
{
private readonly ILiveVCloudClient _client;
private readonly ILogger<LiveVCloudController> _logger;
public LiveVCloudController(ILogger<LiveVCloudController> logger, ILiveVCloudClient client)
{
_logger = logger;
_client = client;
}
/// <summary>
/// 直播管理-创建频道
/// </summary>
/// <param name="name">频道名称。最大长度 64 个字符,支持中文、字母、数字和下划线。</param>
/// <param name="type">频道类型。 0:rtmp,1:hls,2:http</param>
/// <returns></returns>
[HttpGet("createLiveChannel")]
public async Task<LiveCommonResponse<CreateLiveChannelRet>?> CreateLiveChannel(string name, LiveChannelType type)
{
try
{
var response = await _client.CreateLiveChannel(name, type);
if (response is { Code: ResponseStatusCode.Success }) return response;
if (response != null) _logger.LogError($"{response.Code}: {response.Msg}");
return response;
}
catch (Exception e)
{
_logger.LogError(e.Message);
return new LiveCommonResponse<CreateLiveChannelRet>
{ Code = ResponseStatusCode.AddChannelFailed, Msg = e.Message };
}
}
/// <summary>
/// 直播管理-获取频道状态
/// </summary>
/// <param name="cid">频道ID,32位字符串</param>
/// <returns></returns>
[HttpGet("liveChannelStats/{cid}")]
public async Task<LiveCommonResponse<LiveChannelInfo>?> GetLiveChannelStats(string cid)
{
try
{
var response = await _client.GetLiveChannelStats(cid);
if (response is { Code: ResponseStatusCode.Success }) return response;
if (response != null) _logger.LogError($"{response.Code}: {response.Msg}");
return response;
}
catch (Exception e)
{
_logger.LogError(e.Message);
return new LiveCommonResponse<LiveChannelInfo>
{ Code = ResponseStatusCode.SearchFailed, Msg = e.Message };
}
}
}
更新日志
- 1.0.10: Update to .NET 8
- 1.0.9: 错误修改
- 1.0.6: Update ServiceCollection Inject
- 1.0.5: 错误修改
- 1.0.4: 添加直播实时转码、直播回调功能
- 1.0.3: 添加直播安全、直播封面、直播截图功能
- 1.0.2: 引用移到GlobalUsings.cs
- 1.0.1: 添加直播管理和直播录制功能
Product | Versions 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 is compatible. 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.
-
net6.0
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
- Microsoft.Extensions.Http (>= 8.0.0)
- Newtonsoft.Json (>= 13.0.3)
-
net8.0
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
- Microsoft.Extensions.Http (>= 8.0.0)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.