Replace MediaMTX with encrypted SRT ingestion via FFmpeg.NET

Manage bounded UDP listeners directly in Yavsc.Api, expose secret SRT URLs in PostIt, and preserve quotas, revocation and replay. Update deployment and privacy documentation, remove relay configuration, and add real-media lifecycle regressions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Paul Schneider 2026-11-08 16:19:41 +00:00
commit e72df234bc
Signed by: notazof
GPG key ID: AD4B9B545FBD7D12
19 changed files with 681 additions and 645 deletions

View file

@ -27,14 +27,16 @@ public sealed class PodcastScheduleTests
var activation = vm.ActivateObsCommand.ExecuteAsync(null);
vm.SelectedPodcast = api.Plan with { Id = Guid.NewGuid() };
vm.SelectedPodcast = api.Plan;
api.PendingActivation.SetResult(new("rtmps://obs.example:1936", "secret", DateTimeOffset.UtcNow.AddMinutes(30)));
api.PendingActivation.SetResult(new("srt://obs.example:10000?passphrase=secret", "", DateTimeOffset.UtcNow.AddMinutes(30)));
await activation;
Assert.Empty(vm.ObsServerUrl);
Assert.Empty(vm.ObsStreamKey);
api.PendingActivation = new(TaskCreationOptions.RunContinuationsAsynchronously);
activation = vm.ActivateObsCommand.ExecuteAsync(null);
await vm.DeactivateAsync();
api.PendingActivation.SetResult(new("rtmps://obs.example:1936", "secret", DateTimeOffset.UtcNow.AddMinutes(30)));
api.PendingActivation.SetResult(new("srt://obs.example:10000?passphrase=secret", "", DateTimeOffset.UtcNow.AddMinutes(30)));
await activation;
Assert.Empty(vm.ObsServerUrl);
Assert.Empty(vm.ObsStreamKey);
}
finally { File.Delete(path); File.Delete(path + ".settings"); }
@ -56,17 +58,19 @@ public sealed class PodcastScheduleTests
vm.SelectedPodcast = api.Plan;
Assert.True(vm.ActivateObsCommand.CanExecute(null));
await vm.ActivateObsCommand.ExecuteAsync(null);
Assert.Equal("rtmps://obs.example:1936", vm.ObsServerUrl);
Assert.Equal("obs/stream-secret", vm.ObsStreamKey);
Assert.Equal("srt://obs.example:10000?passphrase=stream-secret", vm.ObsServerUrl);
Assert.Empty(vm.ObsStreamKey);
Assert.False(vm.IsBroadcasting);
api.Settings.Save();
Assert.DoesNotContain("stream-secret", await File.ReadAllTextAsync(path + ".settings"));
vm.SelectedPodcast = api.Plan with { Id = Guid.NewGuid(), OwnerId = "other" };
Assert.Empty(vm.ObsServerUrl);
Assert.Empty(vm.ObsStreamKey);
Assert.False(vm.ActivateObsCommand.CanExecute(null));
vm.SelectedPodcast = api.Plan;
await vm.ActivateObsCommand.ExecuteAsync(null);
await vm.DeactivateAsync();
Assert.Empty(vm.ObsServerUrl);
Assert.Empty(vm.ObsStreamKey);
Assert.True(api.ObsEnabled);
await vm.ActivateAsync();
@ -74,6 +78,7 @@ public sealed class PodcastScheduleTests
await vm.ActivateObsCommand.ExecuteAsync(null);
await vm.DeactivateObsCommand.ExecuteAsync(null);
Assert.False(api.ObsEnabled);
Assert.Empty(vm.ObsServerUrl);
Assert.Empty(vm.ObsStreamKey);
Assert.EndsWith("/obs", api.RevokedPath);
await vm.DeactivateAsync();
@ -156,7 +161,7 @@ public sealed class PodcastScheduleTests
{
ObsEnabled = true;
response = PendingActivation is null
? new PodcastObsCredentials("rtmps://obs.example:1936", "obs/stream-secret", DateTimeOffset.UtcNow.AddMinutes(30))
? new PodcastObsCredentials("srt://obs.example:10000?passphrase=stream-secret", "", DateTimeOffset.UtcNow.AddMinutes(30))
: await PendingActivation.Task;
}
else response = new PodcastObsStatus(ObsEnabled, DateTimeOffset.UtcNow.AddMinutes(30), null);

View file

@ -307,7 +307,7 @@ public partial class PodcastsPageViewModel : ViewModelBase
if (SelectedPodcast is { FlowId: not null } selected && selected.OwnerId == _ownerId)
{
var obs = await _client.ObsStatusAsync(selected.Id);
ObsStatus = obs.Error ?? (obs.Enabled ? "Entree OBS activee. Le direct commence a la connexion du diffuseur." : "Entree OBS desactivee.");
ObsStatus = obs.Error ?? (obs.Enabled ? "Entree SRT activee. Le direct commence a la reception des premiers medias." : "Entree OBS desactivee.");
if (!obs.Enabled) ClearObsCredentials(clearStatus: false);
}
Status = "Directs et replays reserves aux utilisateurs connectes.";
@ -410,7 +410,7 @@ public partial class PodcastsPageViewModel : ViewModelBase
_obsPodcastId = podcast.Id;
ObsServerUrl = credentials.ServerUrl;
ObsStreamKey = credentials.StreamKey;
ObsStatus = $"Connectez OBS avant {credentials.ExpiresAt.ToLocalTime():g}. Cette cle remplace toute cle precedente.";
ObsStatus = $"Copiez l'URL SRT secrete dans OBS avant {credentials.ExpiresAt.ToLocalTime():g}, avec la cle de stream vide. Cette URL remplace la precedente.";
}
catch (Exception ex) { Status = $"Activation OBS impossible : {ex.Message}"; }

View file

@ -99,16 +99,14 @@
<Button Content="Arreter et publier le replay" Command="{Binding StopCommand}" />
<StackPanel Spacing="8">
<TextBlock Text="Diffuser l'emission programmee avec OBS Studio" FontWeight="SemiBold" />
<TextBlock Text="Selectionnez votre emission puis activez OBS. Dans OBS : service Personnalise, video H.264, audio AAC, images cles toutes les 2 secondes. Le direct commence lorsque OBS se connecte, pas a l'heure prevue."
<TextBlock Text="Selectionnez votre emission puis activez OBS. Dans OBS : service Personnalise, URL SRT ci-dessous, cle de stream vide, video H.264, audio AAC, images cles toutes les 2 secondes. Le direct commence a la reception des premiers medias, pas a l'heure prevue."
TextWrapping="Wrap" />
<WrapPanel>
<Button Content="Activer OBS / renouveler la cle" Command="{Binding ActivateObsCommand}" Margin="0,0,8,8" />
<Button Content="Revoquer OBS et arreter le diffuseur" Command="{Binding DeactivateObsCommand}" />
</WrapPanel>
<TextBlock Text="Serveur OBS" />
<TextBlock Text="URL SRT secrete (ne pas partager)" />
<TextBox Text="{Binding ObsServerUrl, Mode=OneWay}" IsReadOnly="True" />
<TextBlock Text="Cle de stream (secrete : ne pas partager)" />
<TextBox Text="{Binding ObsStreamKey, Mode=OneWay}" IsReadOnly="True" />
<TextBlock Text="{Binding ObsStatus}" TextWrapping="Wrap" />
<TextBlock Text="Les identifiants ne sont pas sauvegardes dans PostIt. Quitter la page masque la cle, mais n'arrete pas OBS : utilisez la revocation ou arretez OBS."
TextWrapping="Wrap" />