none
play video on ax shockwave flash tool visual studio

    Question

  • hello everybody i need some help, inside my windows form application i use an axShockwaveFlash1 in order to play video from youtube. I have 5 button, each button represent a video. inside the button code i have put: axShockwaveFlash1.Movie = "http://www.youtube.com/v/....";. When i click on one button it plays the video inside the tool, but thereupon ,when i click another button it doesn't play the other video.
    Friday, January 09, 2009 11:12 AM

Answers

  •  

    Hi 2000sam,

    Add this line of code "axFlash.Dispose();" right after "this.Controls.Remove(axFlash);", it sure to work this time.

    public partial class Form1 : Form  
        {  
            private AxShockwaveFlashObjects.AxShockwaveFlash axFlash;  
     
            public Form1()  
            {  
                InitializeComponent();  
                axFlash = new AxShockwaveFlashObjects.AxShockwaveFlash();  
                axFlash.BeginInit();  
                axFlash.Location = new Point(50, 80);  
                axFlash.Name = "Testina";  
                axFlash.TabIndex = 0;  
                axFlash.EndInit();  
                this.Controls.Add(axFlash);  
            }  
     
            private void button1_Click(object sender, EventArgs e)  
            {  
                this.Controls.Remove(axFlash);  
                axFlash.Dispose();  
                axFlash = new AxShockwaveFlashObjects.AxShockwaveFlash();  
                axFlash.BeginInit();  
                axFlash.Location = new Point(50, 80);  
                axFlash.Name = "Testina";  
                axFlash.TabIndex = 0;  
                axFlash.Size = new Size(640, 480);  
                axFlash.EndInit();  
                this.Controls.Add(axFlash);  
                axFlash.LoadMovie(0, "http://www.youtube.com/v/UdmEfgc5aYU");  
            }  
     
            private void button2_Click(object sender, EventArgs e)  
            {  
                this.Controls.Remove(axFlash);  
                axFlash.Dispose();  
                axFlash = new AxShockwaveFlashObjects.AxShockwaveFlash();  
                axFlash.BeginInit();  
                axFlash.Location = new Point(50, 80);  
                axFlash.Name = "Testina";  
                axFlash.TabIndex = 0;  
                axFlash.Size = new Size(640, 480);  
                axFlash.EndInit();  
                this.Controls.Add(axFlash);  
                axFlash.LoadMovie(0, "http://www.youtube.com/v/gDVlQPpVUA8");  
            }  
        } 


    Sincerely,
    Kira Qian


    Please mark the replies as answers if they help and unmark if they don't.
    • Marked as answer by Kira Qian Friday, January 16, 2009 1:33 AM
    Friday, January 16, 2009 1:27 AM

All replies

  •  

    Hi 2000sam,

    You can try to use LoadMovie method.
    axShockwaveFlash.LoadMovie(0, "Movie URL");
    axShockwaveFlash.Play();

    here is an example in VB
    http://blog.shareoffice.it/webmaster/archive/2006/07/01/6451.aspx

    Related topic:
    http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/2e66cb0f-da1d-4684-941d-386b1dafdde1/

    Holp this can help you.
    Sincerely,
    Kira Qian


    Please mark the replies as answers if they help and unmark if they don't.
    Monday, January 12, 2009 7:36 AM
  • no, it doesn't do anything, when click the one button it loads the video but when i click another one it can't load it. And this link doesn't open http://blog.shareoffice.it/webmaster/archive/2006/07/01/6451.aspx. But thanks anyway.
    Monday, January 12, 2009 12:07 PM
  •  

    Hi 2000sam,

    Could you please show me the code of these two button? You just need to show the code of the worked button and the unworked one. I want to know more detail information about your question. Thanks!

    Sincerely,
    Kira Qian


    Please mark the replies as answers if they help and unmark if they don't.
    Tuesday, January 13, 2009 1:34 AM
  • Hi Kira Qian,

    Imagine, inside the form i have one   axShockwaveFlash tool and 5 button. Inside the buttons  code i have put: axShockwaveFlash1.Movie = "http://www.youtube.com/v/....";(video from youtube) only this nothing else.(but i have also try your code). The only thing i want to do is when i click the buttons, to play the video for each one, inside the axShockwaveFlash tool. The problem is that it plays/loads only the first button i click, when i click another button it appears a black screen in axShockwaveFlash tool(=it can't load another video).
    Tuesday, January 13, 2009 4:27 PM
  •  

    Hi 2000sam,

    Yes, when I try to solve your problem and test my code, it also show a black screen with no video. The reason is I cannot find a correct video link on youtube web site.

    The way I try to pick up a video link is open a video in the IE and View souce of Html page. Then search the ".swf". I end up found the link like following.
    http://s.ytimg.com/yt/swf/watch-vfl71976.swf
    http://s.ytimg.com/yt/swf/watch_v8-vfl71976.swf

    Non of them can be played correctly in axShockwaveFlash control. I think your problem may be caused by the same reason. Please try to use the button1's video link in button2, if it works, it badly indicate the problem is the link itself. Also you can copy the link to the IE address bar to test if it is correct.

    Sorry I don't know how to get a valid link in youtube web site.

    Please inform me your test result as soon as possible.

    Sincerely,
    Kira Qian


    Please mark the replies as answers if they help and unmark if they don't.
    Wednesday, January 14, 2009 2:16 AM
  • hi Kira Qian

    look to understand make a new visual c# windows form appliication, inside the form put a Shockwave Flash object and two buttons. inside the private void button1_Click(object sender, EventArgs e) put axShockwaveFlash1.Movie = "http://www.youtube.com/v/UdmEfgc5aYU"; and in the other axShockwaveFlash1.Movie =  "http://www.youtube.com/v/gDVlQPpVUA8"; and debug. click the first button and then the other. check it
    Wednesday, January 14, 2009 9:32 PM
  •  

    Hi 2000sam,

    Here I get a solution, it is not perfect enough, but it does work.

    1 public partial class Form1 : Form  
    2     {  
    3         private AxShockwaveFlashObjects.AxShockwaveFlash axFlash;  
    4  
    5         public Form1()  
    6         {  
    7             InitializeComponent();  
    8  
    9             axFlash = new AxShockwaveFlashObjects.AxShockwaveFlash();  
    10             axFlash.BeginInit();  
    11             axFlash.Location = new Point(50, 80);  
    12             axFlash.Name = "Testina";  
    13             axFlash.TabIndex = 0; 
                axFlash.EndInit(); 
    14             this.Controls.Add(axFlash);  
    15         }  
    16  
    17         private void button1_Click(object sender, EventArgs e)  
    18         {  
    19             this.Controls.Remove(axFlash);  
    20             axFlash = new AxShockwaveFlashObjects.AxShockwaveFlash();  
    21             axFlash.BeginInit();  
    22             axFlash.Location = new Point(50, 80);  
    23             axFlash.Name = "Testina";  
    24             axFlash.TabIndex = 0;  
    25               
    26             axFlash.Size = new Size(640, 480);  
    27             axFlash.EndInit(); 
                this.Controls.Add(axFlash); 
    28             axFlash.LoadMovie(0, "http://www.youtube.com/v/UdmEfgc5aYU");  
    29         }  
    30  
    31         private void button2_Click(object sender, EventArgs e)  
    32         {  
    33             this.Controls.Remove(axFlash);  
    34             axFlash = new AxShockwaveFlashObjects.AxShockwaveFlash();  
    35             axFlash.BeginInit();  
    36             axFlash.Location = new Point(50, 80);  
    37             axFlash.Name = "Testina";  
    38             axFlash.TabIndex = 0;
    39               
    40             axFlash.Size = new Size(640, 480);  
    41             axFlash.EndInit(); 
                this.Controls.Add(axFlash); 
    42             axFlash.LoadMovie(0, "http://www.youtube.com/v/gDVlQPpVUA8");  
    43         }  
    44     } 


    When I load another movie, I create a new instance of AxShockwaveFlashObjects, remove the previous one from the form and add this new one to the form. Then I can load a new movie and play it correctly. I think the problem is caused because the previous movie hasn't been cleaned when a new movie is load. I try many way to clean the previous movie but end up nothing. Since AxShockwaveFlashObjects is a third part component, we don't familiar with it. I recommend you to post your question to the Adobe product forum(http://www.adobe.com/support/forums/) for further help.

    Sincerely,
    Kira Qian


    Please mark the replies as answers if they help and unmark if they don't.
    • Marked as answer by 2000sam Thursday, January 15, 2009 10:59 AM
    • Unmarked as answer by 2000sam Thursday, January 15, 2009 10:59 AM
    • Marked as answer by Kira Qian Friday, January 16, 2009 1:33 AM
    • Unmarked as answer by 2000sam Friday, January 16, 2009 12:53 PM
    Thursday, January 15, 2009 2:22 AM
  • hi Kira Qian,
    thank you for the code, it does work!  do you know how could we stop the sound. For example, when i click on the second button ,i will hear the sound from the first movie(if i don't pause the first one manualy). The perfect one would be to stop the movie that is playing when you click the buttons
    Thursday, January 15, 2009 11:10 AM
  •  

    Hi 2000sam,

    Add this line of code "axFlash.Dispose();" right after "this.Controls.Remove(axFlash);", it sure to work this time.

    public partial class Form1 : Form  
        {  
            private AxShockwaveFlashObjects.AxShockwaveFlash axFlash;  
     
            public Form1()  
            {  
                InitializeComponent();  
                axFlash = new AxShockwaveFlashObjects.AxShockwaveFlash();  
                axFlash.BeginInit();  
                axFlash.Location = new Point(50, 80);  
                axFlash.Name = "Testina";  
                axFlash.TabIndex = 0;  
                axFlash.EndInit();  
                this.Controls.Add(axFlash);  
            }  
     
            private void button1_Click(object sender, EventArgs e)  
            {  
                this.Controls.Remove(axFlash);  
                axFlash.Dispose();  
                axFlash = new AxShockwaveFlashObjects.AxShockwaveFlash();  
                axFlash.BeginInit();  
                axFlash.Location = new Point(50, 80);  
                axFlash.Name = "Testina";  
                axFlash.TabIndex = 0;  
                axFlash.Size = new Size(640, 480);  
                axFlash.EndInit();  
                this.Controls.Add(axFlash);  
                axFlash.LoadMovie(0, "http://www.youtube.com/v/UdmEfgc5aYU");  
            }  
     
            private void button2_Click(object sender, EventArgs e)  
            {  
                this.Controls.Remove(axFlash);  
                axFlash.Dispose();  
                axFlash = new AxShockwaveFlashObjects.AxShockwaveFlash();  
                axFlash.BeginInit();  
                axFlash.Location = new Point(50, 80);  
                axFlash.Name = "Testina";  
                axFlash.TabIndex = 0;  
                axFlash.Size = new Size(640, 480);  
                axFlash.EndInit();  
                this.Controls.Add(axFlash);  
                axFlash.LoadMovie(0, "http://www.youtube.com/v/gDVlQPpVUA8");  
            }  
        } 


    Sincerely,
    Kira Qian


    Please mark the replies as answers if they help and unmark if they don't.
    • Marked as answer by Kira Qian Friday, January 16, 2009 1:33 AM
    Friday, January 16, 2009 1:27 AM
  • thank you Kira Qian you are the best!!!
    Friday, January 16, 2009 12:52 PM
  • hi everybody,

    I use above code but I take an accessViolationException in LoadMovie() function. Any suggestions?

    ferhat

    Monday, August 23, 2010 12:39 PM