Wrox Programmer Forums
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 5th, 2006, 09:23 AM
Registered User
 
Join Date: Dec 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default MCI

Hello, I am working on a Media Player using MCI Libary.
I can play audio and video, but when I play video it doesnt show the video it self... just give me the sounds. when I move my form I see that the video is really behind my form... I have no idea why, I did exactly like in the MCI libary... this is my code:

Code:
        private Player player = new Player();

       //Play method:
            int index = this.listView1.FocusedItem.Index;
            string path2 = this.listView1.Items[index].SubItems[3].Text;
            FileInfo file = new FileInfo(path2);
            try
            {
                if (file.Exists)
                {
                    player.Close();
                    if ((file.Extension == "avi") || (file.Extension == ".mpg") || (file.Extension == ".wmv") || (file.Extension == ".mkv"))
                    {
                        player.Open(file.FullName, this.picVideoWindow);
                    }
                    else
                    {
                        player.Open(file.FullName);
                    }
                    player.Play(false);
                }
                finally
                {
                }

        //Player.open method


        public void Open(string sFileName)
        {

            Pcommand = "open \"" + sFileName + "\" type mpegvideo alias MediaFile";
            mciSendString(Pcommand, null, 0, IntPtr.Zero);

            isOpen = true;
        }


        public void Open(string sFileName, System.Windows.Forms.PictureBox videobox)
        {
            Pcommand = "open \"" + sFileName + "\" type mpegvideo alias MediaFile style child parent " + videobox.Handle.ToInt32();
            mciSendString(Pcommand, null, 0, IntPtr.Zero);
            Pcommand = "put MediaFile window at 0 0 " + videobox.Width + " " + videobox.Height;
            mciSendString(Pcommand, null, 0, IntPtr.Zero);

            isOpen = true;
        }

       //Player.play method

        public void Play(bool loop)
        {
            if (isOpen)
            {

                Pcommand = "play MediaFile";

                if (loop)

                    Pcommand += " REPEAT";

                mciSendString(Pcommand, null, 0, IntPtr.Zero);

            }

        }





Similar Threads
Thread Thread Starter Forum Replies Last Post
Using the Multimedia MCI Control Apocolypse2005 VB How-To 0 November 11th, 2005 03:52 PM
MCI COMMAND octapon VB How-To 4 October 10th, 2005 11:03 AM
displaying video in c# using mci api mmmobasher VS.NET 2002/2003 0 January 17th, 2004 12:58 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.