Skip to content

Commit

Permalink
Merge pull request #31 from baltermia/30-improve-nuget-package-config
Browse files Browse the repository at this point in the history
Improve NuGet Package Configuration
  • Loading branch information
baltermia authored Jul 6, 2023
2 parents f8943a3 + f53e5b1 commit cc27d52
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/package_on_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ jobs:
run: dotnet restore

- name: Build
run: dotnet build --configuration Debug --no-restore
run: dotnet build --configuration Release --no-restore

- name: Test
run: dotnet test --no-build --verbosity normal

- name: Pack
run: dotnet pack --no-build --configuration Debug
run: dotnet pack --no-build --configuration Release

- name: Push NuGet
run: dotnet nuget push "**/*.nupkg" --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate

- name: Push GitHub
run: nuget.exe push "**/*.nupkg" -NoSymbols -SkipDuplicate
run: nuget.exe push "**/*.nupkg" -SkipDuplicate
env:
NUGET_AUTH_TOKEN: ${{ github.token }}
16 changes: 11 additions & 5 deletions BlazorCameraStreamer/BlazorCameraStreamer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,25 @@
<PropertyGroup>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<RootNamespace>BlazorCameraStreamer</RootNamespace>
<AssemblyName>BlazorCameraStreamer</AssemblyName>
<PackageId>BlazorCameraStreamer</PackageId>
<Version>3.0.0</Version>
<Version>3.0.1</Version>
<Authors>Baltermia Clopath</Authors>
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
<RepositoryUrl>https://github.com/baltermia/blazor-camera-streamer/</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Description>A Blazor Component library that adds a easy-to-use camera-streaming functionality, which allows you to receive the streamed data.</Description>
<PackageReleaseNotes>Updated to support .NET6 and .NET7. .NET5 support is deprecated.</PackageReleaseNotes>
<Copyright>Copyright (c) 2023 Baltermia Clopath</Copyright>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<AssemblyName>BlazorCameraStreamer</AssemblyName>
<PackageReadmeFile>NUGET-README.md</PackageReadmeFile>

<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<PublishRepositoryUrl>true</PublishRepositoryUrl>

<RestoreAdditionalProjectSources>
<GenerateDocumentationFile>true</GenerateDocumentationFile>

<RestoreAdditionalProjectSources>
https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json;
https://dotnet.myget.org/F/blazor-dev/api/v3/index.json;
</RestoreAdditionalProjectSources>
Expand All @@ -40,6 +45,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.16" />
<PackageReference Include="Microsoft.NETCore.Platforms" Version="6.0.9" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 8 additions & 0 deletions BlazorCameraStreamer/Components/CameraStreamer.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ namespace BlazorCameraStreamer

private CameraStreamerController streamerApi;

/// <inheritdoc/>
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
Expand Down Expand Up @@ -98,24 +99,31 @@ public async Task ReloadAsync()
await StartAsync();
}

/// <inheritdoc/>
public async Task StartAsync(string camera = null) =>
await streamerApi.StartAsync(camera ?? CameraID);

/// <inheritdoc/>
public async Task StopAsync() =>
await streamerApi.StopAsync();

/// <inheritdoc/>
public async Task ChangeCameraAsync(string newId) =>
await streamerApi.ChangeCameraAsync(CameraID = newId);

/// <inheritdoc/>
public async Task<bool> GetCameraAccessAsync() =>
await streamerApi.GetCameraAccessAsync();

/// <inheritdoc/>
public async Task<MediaDeviceInfoModel[]> GetCameraDevicesAsync() =>
await streamerApi.GetCameraDevicesAsync();

/// <inheritdoc/>
public ValueTask<string> GetCurrentFrameAsync() =>
streamerApi.GetCurrentFrameAsync();

/// <inheritdoc/>
public async ValueTask DisposeAsync() =>
// Check null for streamerApi as otherwise a exception is thrown on page-refresh
await (streamerApi?.DisposeAsync() ?? ValueTask.CompletedTask);
Expand Down
7 changes: 7 additions & 0 deletions BlazorCameraStreamer/Controllers/CameraStreamerController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,32 +70,38 @@ public async Task InitializeAsync(ElementReference videoReference, int width = 6
IsInitialized = true;
}

/// <inheritdoc/>
public async Task StartAsync(string camera = null)
{
// Use the first found camera if no camrea is given
await JSObject.InvokeVoidAsync("start", camera ?? (await GetCameraDevicesAsync()).FirstOrDefault()?.DeviceId);
}

/// <inheritdoc/>
public async Task StopAsync()
{
await JSObject.InvokeVoidAsync("stop");
}

/// <inheritdoc/>
public async Task ChangeCameraAsync(string newId)
{
await JSObject.InvokeVoidAsync("changeCamera", newId);
}

/// <inheritdoc/>
public async Task<bool> GetCameraAccessAsync()
{
return await JSRuntime.InvokeAsync<bool>(StaticInteropPath + ".getCameraAccess");
}

/// <inheritdoc/>
public async Task<MediaDeviceInfoModel[]> GetCameraDevicesAsync()
{
return await GetCameraDevicesAsync(JSRuntime);
}

/// <inheritdoc/>
public async ValueTask DisposeAsync()
{
if (IsInitialized && JSObject != null)
Expand All @@ -106,6 +112,7 @@ public async ValueTask DisposeAsync()
}
}

/// <inheritdoc/>
public ValueTask<string> GetCurrentFrameAsync()
{
return JSObject.InvokeAsync<string>("getCurrentFrame");
Expand Down

0 comments on commit cc27d52

Please sign in to comment.