none
mute or unmute my app sound i using media player

    Question

  • i have the code to mute my app now i need to know how can i mute it if media player is working!
    Tuesday, November 15, 2011 4:03 PM

Answers

  • Hello Hugo,

    By making sure you have added reference of WMPLib.dll, and then you can coding like this: 

    using WMPLib;
    
    WindowsMediaPlayer player = new WindowsMediaPlayer();
            private void button1_Click(object sender, EventArgs e)
            {
                
                player.settings.mute = true;
            }
    
            private void button2_Click(object sender, EventArgs e)
            {
                player.settings.mute = false;
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                player.URL = @"C:\Users\Public\Videos\Sample Videos\Wildlife.wmv";
                //player.URL = @"C:\Windows.old\Program Files\Microsoft Lync Attendee\Media\DefaultHold.wma";
                player.controls.play();
            } 

    Let me know if this doesn't help.

    Regards,


    Helen Zhou [MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by Helen Zhou Tuesday, November 22, 2011 7:23 AM
    Thursday, November 17, 2011 7:58 AM
  • I created a windows media player by :
                         WindowsMediaPlayer player = new WindowsMediaPlayer();

    And then set the play file for it:
                         player.URL = @"C:\Users\Public\Videos\Sample Videos\Wildlife.wmv";

    At last play the windows media player: (which means let the media player working):
                         player.controls.play();

    You can copy my demo and have a try.


    Helen Zhou [MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by Helen Zhou Tuesday, November 22, 2011 7:23 AM
    Thursday, November 17, 2011 9:42 AM

All replies

  • Hello Hugo,

    By making sure you have added reference of WMPLib.dll, and then you can coding like this: 

    using WMPLib;
    
    WindowsMediaPlayer player = new WindowsMediaPlayer();
            private void button1_Click(object sender, EventArgs e)
            {
                
                player.settings.mute = true;
            }
    
            private void button2_Click(object sender, EventArgs e)
            {
                player.settings.mute = false;
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                player.URL = @"C:\Users\Public\Videos\Sample Videos\Wildlife.wmv";
                //player.URL = @"C:\Windows.old\Program Files\Microsoft Lync Attendee\Media\DefaultHold.wma";
                player.controls.play();
            } 

    Let me know if this doesn't help.

    Regards,


    Helen Zhou [MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by Helen Zhou Tuesday, November 22, 2011 7:23 AM
    Thursday, November 17, 2011 7:58 AM
  • where did you test if the media player on the computer is working or not?
    Thursday, November 17, 2011 9:39 AM
  • I created a windows media player by :
                         WindowsMediaPlayer player = new WindowsMediaPlayer();

    And then set the play file for it:
                         player.URL = @"C:\Users\Public\Videos\Sample Videos\Wildlife.wmv";

    At last play the windows media player: (which means let the media player working):
                         player.controls.play();

    You can copy my demo and have a try.


    Helen Zhou [MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by Helen Zhou Tuesday, November 22, 2011 7:23 AM
    Thursday, November 17, 2011 9:42 AM