Preview YouTube Video (WPF)
Authors who paste YouTube embed codes into a WpfHtmlEditor-based authoring tool sometimes find every embed plays on their own development machine, but the same document, opened on a freshly imaged field laptop, shows a blank or static frame instead of video. The document is identical. The network is identical. What differs is a single registry value on the host machine.
What is actually happening: IE7 emulation
The editor's WYSIWYG and Preview modes are hosted by the native System.Windows.Controls.WebBrowser control, a thin wrapper around MSHTML, the Internet Explorer rendering engine also used by the WinForms edition of the control. For backward compatibility, hosted WebBrowser controls default to IE7 emulation regardless of which version of Internet Explorer is actually installed on the machine. YouTube's modern iframe embed assumes a current browser, HTML5 video, modern JavaScript, current TLS ciphers, and silently degrades or refuses to load on IE7-emulated MSHTML.
A machine that already has a FEATURE_BROWSER_EMULATION registry value set, for example from an earlier project that hosted a WebBrowser control, plays the embed; a machine without that value does not, even with the same document and the same network. The editor cannot raise the emulation level at runtime; Windows resolves it once, when the WebBrowser is instantiated, by reading the registry.
Step 1: confirm playback in Preview
Verify embeds in EditorModes.ReadOnlyPreview, which renders the document the way an end user will see it, using the editor's dedicated preview WebBrowser instance. With the registry value below applied, Preview plays YouTube embeds the same as any modern browser. WYSIWYG mode is for authoring; Preview is for verification.
// Toggle to Preview to verify a YouTube embed plays:
NoteEditor.EditorMode = SpiceLogic.HtmlEditor.Abstractions.EditorModes.ReadOnlyPreview;' Toggle to Preview to verify a YouTube embed plays:
NoteEditor.EditorMode = SpiceLogic.HtmlEditor.Abstractions.EditorModes.ReadOnlyPreviewStep 2: register the executable for modern emulation
Ship a registry entry that upgrades your application's WebBrowser host to IE11 edge mode. Add a DWORD value named after the executable's file name (including the extension) with the value 11001 decimal under FEATURE_BROWSER_EMULATION:
Windows Registry Editor Version 5.00
; Per-user (no admin required):
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION]
"YourApp.exe"=dword:00002af9
; Per-machine (admin required):
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION]
"YourApp.exe"=dword:00002af9Common decimal values: 11001 (IE11 edge), 11000 (IE11), 10001 (IE10 edge), 9999 (IE9). The hex equivalent of 11001 is 0x00002AF9.
This is a per-process registry key, not a per-control setting, so it applies identically regardless of whether the process hosts WpfHtmlEditor or the WinForms edition. One difference from the WinForms authoring flow: WPF's XAML designer in Visual Studio does not host a live WebBrowser at design time the way the WinForms Windows Forms designer does, so there is no devenv.exe registration to add for design-time preview. Only your compiled application's own executable needs the key.
Step 3: ship it from the installer, or set it at startup
A WiX installer is the right place to write the registry key; a deployed field image picks it up automatically on next update. For shops without an installer pipeline, set the value at application startup, before any WpfHtmlEditor instance is constructed. The host process picks the emulation level up the first time it instantiates a WebBrowser:
using Microsoft.Win32;
static void SetIeEmulation()
{
string exe = System.IO.Path.GetFileName(
System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
using var key = Registry.CurrentUser.CreateSubKey(
@"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION");
key.SetValue(exe, 11001, RegistryValueKind.DWord);
}Imports Microsoft.Win32
Shared Sub SetIeEmulation()
Dim exe As String = System.IO.Path.GetFileName(
System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName)
Using key = Registry.CurrentUser.CreateSubKey(
"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION")
key.SetValue(exe, 11001, RegistryValueKind.DWord)
End Using
End SubThe long view
FEATURE_BROWSER_EMULATION caps out at IE11. Sites that drop IE11 support entirely will eventually fail in Preview even with the registry tweak in place. For applications where modern embed compatibility is critical, the long-term direction is a WebView2-backed editor host; that work is tracked on the product roadmap for both editions. In the meantime, the IE11 emulation switch keeps YouTube, Vimeo, and the major embed providers working today.
Ask your AI to do this
Let your assistant do this for you. With the SpiceLogic MCP server connected, paste this into Claude Code, Cursor, or VS Code Copilot in agent mode.
Using the SpiceLogic WPF HTML Editor already referenced in my project, help me figure out why a pasted YouTube embed plays fine on my dev machine but fails on end-user laptops: first verify playback by switching EditorMode to EditorModes.ReadOnlyPreview, and if it still fails there, write the per-user browser-emulation registry entry, keyed to my exe's filename, that pins the editor's hosting WebBrowser control to a modern rendering mode instead of its legacy IE7 default. Verify the EditorMode and EditorModes member names with the SpiceLogic MCP tools before making the change.