How to play the media file in Sequence using WMP in c# RRS feed

  • Question

  • Hey can anybody please suggest me How to play the more then one media file one after the other/ in sequence 

    without any flickering/glitch/pause using Window Media Player in C#. please it will be of grate help to me.

     private void button1_Click(object sender, EventArgs e)
                axWindowsMediaPlayer1.URL = "C:\\Vertical Media\\Air Asia.mp4";
                timer1.Enabled = true;
                timer1.Interval = 10;
                timer1.Tick += new EventHandler(delegate(Object o, EventArgs Timer_e)
                        if (axWindowsMediaPlayer1.Ctlcontrols.currentPosition > axWindowsMediaPlayer1.currentMedia.duration - 0.2 &&  axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsPlaying)
                            axWindowsMediaPlayer1.URL = "C:\\Vertical Media\\AIS.mp4";
                            axWindowsMediaPlayer1.stretchToFit = true;
                        if (axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsPlaying)
                            axWindowsMediaPlayer1.fullScreen = true;


    the code run successfully but i get the annoyning flicker when the URL is changed....

    please suggest me to remove it.

    • Edited by Shweta Chhajed Tuesday, July 17, 2012 10:12 AM
    • Moved by Jason Dot Wang Friday, August 10, 2012 5:49 AM this thread is about DirectShow Development (From:Visual C# General)
    Tuesday, July 17, 2012 8:52 AM

All replies

  • Hi Shweta,

      Based on your descriptions, I could give your some suggestions about it.You can use following two winAPI to prohibit controls redrawing and resume controls redrawing.


    [DllImport("User32.dll", CharSet=CharSet.Auto, SetLastError=true)] internal static extern int SendMessage(IntPtr hwnd, int msg, int wParam, int lParam); //Start manipulating controls SendMessage(control.Handle, 11, 0, 0); //prohabit redrawing SendMessage(control.Handle, 11, -1, 0);

    //resume redrawing

       Hope it helps you.


      Jason Wang

    Jason Wang [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by Jason Dot Wang Wednesday, July 25, 2012 8:16 AM
    • Unmarked as answer by Jason Dot Wang Wednesday, August 1, 2012 1:26 AM
    Thursday, July 19, 2012 3:35 AM
  • Hey Jason Sorry but can you please explain it in more detail?

    In between, can you please let me know How to add an Image over this media file using Microsoft.Directx or WMP.

    I mean my boss want me to display a small image onto this media/video stream, like

    the image will be displayed on topmost layer of screen & the video will be playing in Background. 



    Wednesday, July 25, 2012 9:56 AM
  • Hi Shweta,

      Welcome to MSDN Forum Support.

      If you want o add the image to media/video stream, you'd better using DirectShow to do so. I suggest you that you could post this on the DirectShow Development .


      Jason Wang

    Jason Wang [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, August 1, 2012 7:32 AM