Quantcast
Channel: Media Foundation Development for Windows Desktop forum
Viewing all articles
Browse latest Browse all 1079

c# Windows Media Player - Plays one video, won't play the next one

$
0
0

Hi all,

I wrote a simple little program to unveil the draft order for my league's next Fantasy Football draft.  The premise is simple, each time the button at the bottom was clicked, it would play a video picked for the person who got the next pick.  On my system, everything works great.  However, on my wife's and brother's computers, the first button click works perfectly, but each additional click puts a name on the draft board, but the video doesn't play.  There is no error message.  I tried installing as many dependencies as I could find, but nothing works.  Here is the code, any ideas:

private void button1_Click(object sender, EventArgs e)
        {
            axWindowsMediaPlayer1.stretchToFit = true;
            if (pickNum >= 0)
            {
                Random rand = new Random(DateTime.Now.Millisecond);

                double pick = 0;
                int x = 0;

                if (pickNum == 9)
                {
                    listBox1.Items[pickNum] = "10. Player 10";
                    File.AppendAllText("Order.txt", listBox1.Items[pickNum].ToString());
                    pickNum--;
                    axWindowsMediaPlayer1.URL = "Video10.wmv";
                }
                else if (pickNum == 8)
                {
                    axWindowsMediaPlayer1.URL = "Video9.wmv";
                    listBox1.Items[pickNum] = "9. Player 9";
                    File.AppendAllText("Order.txt", listBox1.Items[pickNum].ToString());
                    pickNum--;
                }
                else if (pickNum == 7)
                {
                     axWindowsMediaPlayer1.URL = "Video.wmv";
                    listBox1.Items[pickNum] = "Player Name";
                    File.AppendAllText("Order.txt", listBox1.Items[pickNum].ToString());
                    pickNum--;
                }
                else if (pickNum == 6)
                {
                    axWindowsMediaPlayer1.URL = "Video.wmv";
                    listBox1.Items[pickNum] = "Player Name";
                    File.AppendAllText("Order.txt", listBox1.Items[pickNum].ToString());
                    pickNum--;
                }
                else
                {
                    end = false;
                    while (!end)
                    {
                        pick = rand.NextDouble() * 100;
                        if (pick < 30 && ten == false)
                        {
                           axWindowsMediaPlayer1.URL = "Video.wmv";
                           listBox1.Items[pickNum] = "Player Name";
                            File.AppendAllText("Order.txt", listBox1.Items[pickNum].ToString());
                            ten = true;
                            end = true;
                        }
                        else if (pick < 54 && nine == false)
                        {
                            axWindowsMediaPlayer1.URL = "Video.wmv";
                            listBox1.Items[pickNum] = "Player Name";
                            File.AppendAllText("Order.txt", listBox1.Items[pickNum].ToString());
                            nine = true;
                            end = true;
                        }
                        else if (pick < 72 && eight == false)
                        {
                            axWindowsMediaPlayer1.URL = "Video.wmv";
                            listBox1.Items[pickNum] = "Player Name";
                            File.AppendAllText("Order.txt", listBox1.Items[pickNum].ToString());
                            eight = true;
                            end = true;
                        }
                        else if (pick < 85 && seven == false)
                        {
                            axWindowsMediaPlayer1.URL = "Video.wmv";
                            listBox1.Items[pickNum] = "Player Name";
                            File.AppendAllText("Order.txt", listBox1.Items[pickNum].ToString());
                            seven = true;
                            end = true;
                        }
                        else if (pick < 94 && six == false)
                        {
                           axWindowsMediaPlayer1.URL = "Video.wmv";
                            listBox1.Items[pickNum] = "Player Name";
                            File.AppendAllText("Order.txt", listBox1.Items[pickNum].ToString());
                            six = true;
                            end = true;
                        }
                        else if (five == false)
                        {
                           axWindowsMediaPlayer1.URL = "Video.wmv";
                            listBox1.Items[pickNum] = "Player Name";
                            File.AppendAllText("Order.txt", listBox1.Items[pickNum].ToString());
                            five = true;
                            end = true;
                        }

                        if (end)
                        {
                            x++;
                            pickNum--;
                        }
                    }
                }
            }


Viewing all articles
Browse latest Browse all 1079

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>