0

My application currently uses the AXWindowsMediaPlayer component to play videos and in turn sound is played using the default sound device.

I need to add support for playing multiple videos and in turn I need to be able to setup audio sources for each of the videos.

Thoughts on how to achieve this:

  1. Set the audio endpoint of the AXWindowsMediaPlayer to my specified device (I Know I can do this in windows media player program but don't know how in code).
  2. Play the video using WMP and stream the audio using NAudio.

Can anyone provide some recommendations on how best to achieve what I need and perhaps a link to some documentation I need to be looking at? I can't seem to find anything on this.

webnoob
  • 15,747
  • 13
  • 83
  • 165
  • Please provide feedback on the down vote. I'm not sure how better to explain my problem and I don't have any code that is relevant as I can't find any documentation around this subject ... – webnoob Jan 22 '16 at 16:17
  • I have done this in the past using directshow, you create a filter graph then you remove the default audio rendering, you add the one you want to use and reconnect the graph. However directshow is somehow considered deprecated so there might be more "modern" ways of implementing this. I do not think you will be able to do it just with axWinMediaPlayer though – yms Jan 22 '16 at 16:27
  • @yms - It appears that media foundation has replaced directshow (as of vista). I know naudio uses this so perhaps that route may work ... – webnoob Jan 22 '16 at 16:54

1 Answers1

1

I ended up using NAUDIO for this.

This is the code I used:

var waveReader = new MediaFoundationReader(playListItem.FilePath);
_waveOut = new WaveOut {DeviceNumber = playListItem.PlayerScreen.AudioDevice.Id};
_waveOut.Init(waveReader);
wmPlayer.settings.volume = 0;
wmPlayer.URL = playListItem.FilePath;
_waveOut.Play();
webnoob
  • 15,747
  • 13
  • 83
  • 165