Detect headphones in Windows [duplicate]

So…I think I might found something REALY obscure..

Can any of you guys check if that works? – You MUST have the NAudio library referenced..

var enumerator = new MMDeviceEnumerator();
var d = enumerator.GetDefaultAudioEndpoint(DataFlow.Render, Role.Multimedia);
Console.WriteLine(d.Properties[new Guid("46d16a2c-5654-41c0-911e-7860d2bce7ee")].Value.ToString());

This property return’s 1 (Plugged) or 0 (Unplugged).. and It’s working realy good for me..

UPDATE: Just published the app on CodePlex – iTunesHead

Leave a Comment