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:
- 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 - Cleanup —
MediaGlobal.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
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