From 7ace9568f8a786f0db8f8d2f0a24db5c4731601c Mon Sep 17 00:00:00 2001 From: Akshay Gadher Date: Thu, 5 Mar 2026 12:28:43 +0530 Subject: [PATCH] fix: Add PresentationCore assembly for Windows sound playback The System.Windows.Media.MediaPlayer class requires the PresentationCore assembly to be loaded. Without it, PowerShell throws: "Cannot find type [System.Windows.Media.MediaPlayer]" This fix adds Add-Type -AssemblyName PresentationCore before creating the MediaPlayer object. Tested and confirmed working on Windows. --- src/extension.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/extension.ts b/src/extension.ts index 855db68..2170e58 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -64,7 +64,7 @@ function playSound(filePath: string) { } else if (platform === "linux") { cmd = `mpg123 -q "${filePath}" 2>/dev/null || aplay "${filePath}"`; } else if (platform === "win32") { - cmd = `powershell -c "$p = New-Object System.Windows.Media.MediaPlayer; $p.Open('${filePath}'); $p.Play(); Start-Sleep 3"`; + cmd = `powershell -c "Add-Type -AssemblyName PresentationCore; $p = New-Object System.Windows.Media.MediaPlayer; $p.Open('${filePath}'); $p.Play(); Start-Sleep 3"`; } else { return; }