bb5dcb4ba2
Test button next to Start runs the real private-only go-live pipeline as a session variant (IsTestStream): BeginTestStream -> extracted StartStreamingSession(alsoRecord:false) shared with the dialog path — no Go Live dialog, no 'last live' stamp, no recording. Gold top bar + TEST badge + 'End Test' button face; TEST drawer (third right-rail pull-out, three-way exclusivity) auto-opens once the liveChatId resolves. Chat tooling: Mock Chat Input sends a REAL liveChat/messages.insert (YouTubeStreamService.InsertChatMessageAsync) that round-trips the real ~2s poll and renders through the live overlay; simulated Subscriber/New Member/Super Chat events inject through the poller's MessageReceived seam (YouTubeChatService.InjectSimulatedMessage, ChatMessage.IsSimulated) — the insert API only creates textMessageEvent, so non-text events are local-only by design (ref: developers.google.com/youtube/v3/live/docs/liveChatMessages/insert). Scopes youtube + youtube.force-ssl already cover insert; no re-consent. Good Dog: ytLive.Tests/TestStreamTests.cs — coordinator protocol with fake HTTP + real-window drawer exclusivity/gate. 0 warnings; 314/314 pass (clean run; intermittent host abort is the pre-existing WinRT-webcam flake). Docs ride in the same change: TASKS.md row 41, TASKS/task-41-test-stream-mode.md, ai.md (YouTube Live API constraints), HANDOFF rewrite.
60 lines
2.3 KiB
C#
60 lines
2.3 KiB
C#
using ytLive.Services;
|
|
|
|
namespace ytLive.ViewModels;
|
|
|
|
public partial class MainViewModel
|
|
{
|
|
/// <summary>Test seam (mirrors CameraEnumeratorOverride): tests inject a fake
|
|
/// stats service before constructing the VM so refresh never hits the network.</summary>
|
|
internal static Func<ChannelStatsService>? ChannelStatsFactoryOverride { get; set; }
|
|
|
|
/// <summary>The YPP pull-out backing VM — the drawer below Stream Settings
|
|
/// on the Live screen's right edge (TASK 39).</summary>
|
|
public Services.YppTrackerViewModel Ypp { get; private set; } = null!;
|
|
|
|
/// <summary>The Test Stream pull-out backing VM — the TEST drawer at the
|
|
/// bottom of the right rail (TASK 41): mock chat input (real insert →
|
|
/// poll round-trip) + locally-simulated member / SuperChat / subscriber rows.</summary>
|
|
public Services.TestSessionViewModel TestSession { get; private set; } = null!;
|
|
|
|
private void InitYpp()
|
|
{
|
|
Ypp = new YppTrackerViewModel(
|
|
() => _layoutStore,
|
|
() => ChannelStatsFactoryOverride?.Invoke() ?? new ChannelStatsService(_youtubeAuth),
|
|
() => IsConnected,
|
|
() => _youtubeAuth.CurrentChannel?.DisplayName);
|
|
|
|
TestSession = new TestSessionViewModel(
|
|
_youtubeStream,
|
|
_youtubeChat,
|
|
onEndStream: StopStream);
|
|
|
|
// One drawer at a time: the three pull-outs share the preview's right edge,
|
|
// so opening one collapses the other two (all directions).
|
|
BroadcastForm.PropertyChanged += (_, e) =>
|
|
{
|
|
if (e.PropertyName == nameof(LiveBroadcastFormViewModel.IsDrawerOpen) && BroadcastForm.IsDrawerOpen)
|
|
{
|
|
Ypp.IsDrawerOpen = false;
|
|
TestSession.IsDrawerOpen = false;
|
|
}
|
|
};
|
|
Ypp.PropertyChanged += (_, e) =>
|
|
{
|
|
if (e.PropertyName == nameof(YppTrackerViewModel.IsDrawerOpen) && Ypp.IsDrawerOpen)
|
|
{
|
|
BroadcastForm.IsDrawerOpen = false;
|
|
TestSession.IsDrawerOpen = false;
|
|
}
|
|
};
|
|
TestSession.PropertyChanged += (_, e) =>
|
|
{
|
|
if (e.PropertyName == nameof(TestSessionViewModel.IsDrawerOpen) && TestSession.IsDrawerOpen)
|
|
{
|
|
BroadcastForm.IsDrawerOpen = false;
|
|
Ypp.IsDrawerOpen = false;
|
|
}
|
|
};
|
|
}
|
|
} |