Question

may i ask, is that any way to manipulate an media element(an audio) to either left stereo or right stereo when the user plug in an eye piece to their device. Hm...is it possible do it on the xaml or the c#?

<MediaElement x:Name="MySound" Source="/sound/haha.mp3" Visibility="Collapsed" ></MediaElement>
Was it helpful?

Solution

You can use the MediaElement.Balance property. Setting it to -1 will have 100% of the volume go to the left speaker and 1 will move the volume to the right. 0 is center so the volume is evenly distributed to both speakers (this is the default).

Let's say you want to move all the sound to the left speaker, you can set it in XAML like this

<MediaElement x:Name="MySound" Balance="-1" Source="/sound/haha.mp3" Visibility="Collapsed" ></MediaElement>

Or from the code behind like this

MySound.Balance = -1.0;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top