capture the media type (mpeg,wav,mp3,jpeg,wav) etf. from a playlist in a windows media control

thecruz
thecruz used Ask the Experts™
on
I've been trying to capture it using the following code but it wont work.  Please help


private void axWindowsMediaPlayer1_CurrentItemChange(object sender, AxWMPLib._WMPOCXEvents_CurrentItemChangeEvent e)
        {
            int count = axWindowsMediaPlayer1.currentPlaylist.count;
            string mediaItems = "";

            // Clear any previous contents of the text box.
           

            // Loop through the playlist and store each media item name.
            
                //mediaItems[i] = axWindowsMediaPlayer1.currentMedia.sourceURL.ToString();
                mediaItems = axWindowsMediaPlayer1.currentPlaylist.get_Item(0).sourceURL.ToString();
                //MessageBox.Show(mediaItems[i]);
                if (mediaItems.Contains(".avi"))
                {
                    SlideShowOn = false;
                }
                else
                {
                    SlideShowOn = true;
                }
            
        }

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Mike TomlinsonHigh School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
Top Expert 2009

Commented:
Did you omit the outer loop on purpose?...

This line:

    mediaItems = axWindowsMediaPlayer1.currentPlaylist.get_Item(0).sourceURL.ToString();

Should have a variable such as "i" from a For loop instead of a 0 (zero):

    for (int i = 0; i < count; i++)
    {
        mediaItems = axWindowsMediaPlayer1.currentPlaylist.get_Item(i).sourceURL.ToString();

    }
Try:

axWindowsMediaPlayer1.currentPlaylist.get_Item(0).getItemInfo("FileType");

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial