Stream custom live channels using your own media
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

195 lines
8.6 KiB

@page "/system/troubleshooting"
@using System.Runtime.InteropServices
@using System.Text.Json
@using System.Text.Json.Serialization
@using ErsatzTV.Application.Troubleshooting
@using ErsatzTV.Application.Troubleshooting.Queries
@implements IDisposable
@inject IMediator Mediator
@inject IJSRuntime JsRuntime
<MudForm Style="max-height: 100%">
<div class="d-flex flex-column" style="height: 100vh; overflow-x: auto">
<MudContainer MaxWidth="MaxWidth.ExtraLarge" Class="pt-8">
<MudText Typo="Typo.h5" Class="mb-2">Troubleshooting</MudText>
<MudDivider Class="mb-6"/>
<MudTabs Class="mb-6">
<MudTabPanel Text="Tools">
<MudPaper Class="pa-6" Style="max-height: 500px">
<MudStack>
<!--
<MudButton Variant="Variant.Filled"
Color="Color.Secondary"
StartIcon="@Icons.Material.Filled.Troubleshoot"
Href="system/troubleshooting/playback"
Style="margin-right: auto"
Disabled="true"
Class="mt-6">
Playback Troubleshooting
</MudButton>
-->
<MudButton Variant="Variant.Filled"
Color="Color.Secondary"
StartIcon="@Icons.Material.Filled.Checklist"
Href="system/troubleshooting/sequential-schedule"
Class="mt-6"
Style="margin-right: auto">
Sequential Schedule Validation
</MudButton>
<MudButton Variant="Variant.Filled"
Color="Color.Secondary"
StartIcon="@Icons.Material.Filled.Troubleshoot"
Href="system/troubleshooting/block-playout"
Class="mt-6"
Style="margin-right: auto">
Block Playout Troubleshooting
</MudButton>
</MudStack>
</MudPaper>
</MudTabPanel>
<MudTabPanel Text="General">
<MudPaper Class="pa-6">
<div class="overflow-y-scroll" style="max-height: 500px">
<pre class="wrap-pre">
<code @ref="_troubleshootingView">@_troubleshootingInfo</code>
</pre>
</div>
<MudButton Variant="Variant.Filled" Color="Color.Primary" Class="mt-4" OnClick="@(() => CopyToClipboard(_troubleshootingView))">
Copy
</MudButton>
</MudPaper>
</MudTabPanel>
@if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
<MudTabPanel Text="VideoToolbox">
<MudPaper Class="pa-6">
<div class="overflow-y-scroll" style="max-height: 500px">
<pre class="wrap-pre">
<code @ref="_videoToolboxView">@_videoToolboxCapabilities</code>
</pre>
</div>
<MudButton Variant="Variant.Filled" Color="Color.Primary" Class="mt-4" OnClick="@(() => CopyToClipboard(_videoToolboxView))">
Copy
</MudButton>
</MudPaper>
</MudTabPanel>
}
else
{
<MudTabPanel Text="NVIDIA">
<MudPaper Class="pa-6">
<div class="overflow-y-scroll" style="max-height: 500px">
<pre class="wrap-pre">
<code @ref="_nvidiaView">@_nvidiaCapabilities</code>
</pre>
</div>
<MudButton Variant="Variant.Filled" Color="Color.Primary" Class="mt-4" OnClick="@(() => CopyToClipboard(_nvidiaView))">
Copy
</MudButton>
</MudPaper>
</MudTabPanel>
<MudTabPanel Text="QSV">
<MudPaper Class="pa-6">
<div class="overflow-y-scroll" style="max-height: 500px">
<pre class="wrap-pre">
<code @ref="_qsvView">@_qsvCapabilities</code>
</pre>
</div>
<MudButton Variant="Variant.Filled" Color="Color.Primary" Class="mt-4" OnClick="@(() => CopyToClipboard(_qsvView))">
Copy
</MudButton>
</MudPaper>
</MudTabPanel>
}
@if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
<MudTabPanel Text="VAAPI">
<MudPaper Class="pa-6">
<div class="overflow-y-scroll" style="max-height: 500px">
<pre class="wrap-pre">
<code @ref="_vaapiView">@_vaapiCapabilities</code>
</pre>
</div>
<MudButton Variant="Variant.Filled" Color="Color.Primary" Class="mt-4" OnClick="@(() => CopyToClipboard(_vaapiView))">
Copy
</MudButton>
</MudPaper>
</MudTabPanel>
}
</MudTabs>
</MudContainer>
</div>
</MudForm>
@code {
private CancellationTokenSource _cts;
private string _troubleshootingInfo;
private string _nvidiaCapabilities;
private string _qsvCapabilities;
private string _vaapiCapabilities;
private string _videoToolboxCapabilities;
private ElementReference _troubleshootingView;
private ElementReference _nvidiaView;
private ElementReference _qsvView;
private ElementReference _vaapiView;
private ElementReference _videoToolboxView;
public void Dispose()
{
_cts?.Cancel();
_cts?.Dispose();
}
protected override async Task OnParametersSetAsync()
{
_cts?.Cancel();
_cts?.Dispose();
_cts = new CancellationTokenSource();
var token = _cts.Token;
try
{
TroubleshootingInfo info = await Mediator.Send(new GetTroubleshootingInfo(), token);
_troubleshootingInfo = JsonSerializer.Serialize(
new
{
info.Version,
Environment = info.Environment.OrderBy(x => x.Key).ToDictionary(x => x.Key, x => x.Value),
info.Cpus,
info.VideoControllers,
info.Health,
info.FFmpegSettings,
AviSynth = new
{
Demuxer = info.AviSynthDemuxer,
Installed = info.AviSynthInstalled
},
info.Channels,
info.FFmpegProfiles
},
new JsonSerializerOptions
{
Converters = { new JsonStringEnumConverter() },
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
WriteIndented = true
});
_nvidiaCapabilities = info.NvidiaCapabilities;
_qsvCapabilities = info.QsvCapabilities;
_vaapiCapabilities = info.VaapiCapabilities;
_videoToolboxCapabilities = info.VideoToolboxCapabilities;
}
catch (OperationCanceledException)
{
// do nothing
}
catch (Exception ex)
{
_troubleshootingInfo = ex.ToString();
}
}
private async Task CopyToClipboard(ElementReference view) => await JsRuntime.InvokeVoidAsync("clipboardCopy.copyText", view);
}