Reputation: 719
I'm writing a Media Player using WPF and the MediaElement. I was playing a video i have that has several audio tracks. But they are both playing at the same time :(
How do i just play one of them ? is it at all possible ?
Upvotes: 1
Views: 2538
Reputation: 46
I think this problem is in the audio and video DirectShow codecs you use. Can you play the video correct in the Windows Media Player? If no, please re-install the appropriated codecs.
Some months ago I have completely prototyped the requirements to switch audio tracks in order to show the video-help in our multi-language software. My experience shows some alternatives:
Use the WMP-control via WinForms host, and then change the language like:
var control = ((IWMPControls3)wmpControl.Ctlcontrols);
control.currentAudioLanguage = 9; // english
The Complete list of the LCID you can find here. To list all audio tracks in the video you can use something like:
wmpControl.PlayStateChange += (o, args) => {
if(args.newState == 3) {
var control = ((IWMPControls3)wmpControl.Ctlcontrols);
for(int i = 1; i <= control.audioLanguageCount; i++) {
MessageBox.Show(control.getAudioLanguageID(i) + ": " + control.getAudioLanguageDescription(i));
}
}
};
I hope this helps you to choose your solution.
Upvotes: 2
Reputation: 4268
It is not possible with the WPF MediaElement. If you have some DirectShow know-how, you can try my WPF MediaKit and either modify the MediaUriElement/Player or create your own.
Upvotes: 0