Table of Contents

WPF App Demo

The Demo.Streaming.WPF project is a Windows Presentation Foundation desktop application that demonstrates capture, playback, mixing, and WebRTC communication using the VASTreaming SDK.

Application Initialization

App

protected override void OnStartup(StartupEventArgs e)
{
    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();

    base.OnStartup(e);
}

protected override void OnExit(ExitEventArgs e)
{
    VAST.Media.MediaGlobal.Uninitialize();
    base.OnExit(e);
}

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. CleanupMediaGlobal.Uninitialize() is called on exit 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.Owner = this;
    window.ShowDialog();
}

Some demos require specific compilation symbols:

private void btnDemo2_Click(object sender, RoutedEventArgs e)
{
#if VAST_FEATURE_MIXING
    var window = new ExtendedCaptureWindow();
    window.Owner = this;
    window.ShowDialog();
#endif
}

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
ExtendedCaptureWindow Advanced capture with video mixing and compositing Advanced Capture and Mixing
SimplePlayerWindow Basic media playback Simple Playback
ExtendedPlayerWindow Advanced playback with recording and snapshots Advanced Playback
WebRTCTwoWayWindow Two-way WebRTC communication Two-Way WebRTC

ExtendedCaptureWindow requires the VAST_FEATURE_MIXING compilation symbol. WebRTCTwoWayWindow requires the VAST_FEATURE_WEBRTC compilation symbol.

The WPF demo does not include equivalents for the One-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