WinUI App Demo
The Demo.Streaming.WinUI project is a Windows UI 3 (WinUI) desktop application that demonstrates capture and playback using the VASTreaming SDK.
Application Initialization
App
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
{
VAST.Common.License.Key = "YOUR_LICENSE_KEY";
string appFolderPath = System.IO.Path.GetDirectoryName(
new Uri(AppContext.BaseDirectory).LocalPath);
VAST.Common.Log.LogLevel = VAST.Common.Log.Level.Debug;
VAST.Common.Log.LogFileName = System.IO.Path.Combine(
appFolderPath, "VAST.Demo.Streaming.log");
VAST.Common.NtpTime.Sync();
_window = new MainWindow();
_window.Activate();
_window.Closed += (sender, args) =>
{
VAST.Media.MediaGlobal.Uninitialize();
};
}
The initialization performs the following:
- License — the license key must be set before any other VASTreaming operation
- Logging — configures the log file in the application folder
- NTP sync —
NtpTime.Sync()synchronizes the internal clock for accurate timestamp generation and sources synchronization - Main window — the
MainWindowis a launcher menu with buttons for each demo page - Cleanup —
MediaGlobal.Uninitialize()is called when the window closes to stop internal monitoring threads and release resources
MainWindow
The MainWindow provides a button for each demo:
private void btnDemo1_Click(object sender, RoutedEventArgs e)
{
var window = new SimpleCaptureWindow();
window.Activate();
}
Demo Pages
The application provides the following demo pages, which cover the same functionality as the corresponding MAUI App Demo pages:
| Window | Description | MAUI Equivalent |
|---|---|---|
SimpleCaptureWindow |
Camera/microphone capture and streaming | Simple Capture |
SimplePlayerWindow |
Basic media playback | Simple Playback |
The WinUI demo does not include equivalents for the Advanced Capture and Mixing, Advanced Playback, One-Way WebRTC, Two-Way WebRTC, and Embedded Server pages.
Setup
Set the license key in
App.xaml.cs:VAST.Common.License.Key = "YOUR_LICENSE_KEY";Run the application
See Also
- Sample Applications — overview of all demo projects
- MAUI App Demo — cross-platform equivalent with the same core functionality