Table of Contents

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:

  1. License — the license key must be set before any other VASTreaming operation
  2. Logging — configures the log file in the application folder
  3. NTP syncNtpTime.Sync() synchronizes the internal clock for accurate timestamp generation and sources synchronization
  4. Main window — the MainWindow is a launcher menu with buttons for each demo page
  5. CleanupMediaGlobal.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

  1. Set the license key in App.xaml.cs:

    VAST.Common.License.Key = "YOUR_LICENSE_KEY";
    
  2. Run the application

See Also