Search code examples
c#wpfwinformsactivexvlc

C#, No video, audio only, VLC using multiple forms, Black Screen?


Can someone please tell me whey I am getting a black screen with no video, only sound?

private void screen1btnPlay_Click(object sender, EventArgs e)
    {
        ScreenOne playScreen1 = new ScreenOne();
        playScreen1.PlayScreenOne();
    }

... and the other form is like this:

public partial class ScreenOne : Form
{
    public ScreenOne()
    {
        InitializeComponent();
    }


    public void PlayScreenOne()
    {
        axVLCPlugin21.playlist.add("file:///" + @"Filepath", null);
        axVLCPlugin21.playlist.play();
    }




}

Sound works fine, but no video. All the properties of the VLC are left to default, is there something I need to change when using this plugin across multiple forms? Anyone know what's wrong?

Update:: I rebuilt the program in WPF and I am having the same problem. When I have a button on the second form (same form as player) it works fine, as soon as I call it from the main form, sound only. ugh!


Solution

  • I figured out my problem on my own!

    When I was creating this instance,

    ScreenOne playScreen1 = new ScreenOne();
    

    I was actually creating a redundant instance of what I was trying to do, I'm not sure if that's the right way to put it but I basically already had an instance of the second form and was making another separate instance of the form that was named differently.

    I already had in my code to open the second form

    Screen2 Screen2 = new Screen2(); 
    private void openScreen2Button_Click(object sender, EventArgs e)
        {
            Screen2.Show();
        }
    

    Then later was doing this which is WRONG, I was adding playscreen1 when I should still have been using Screen2.

    Screen2 playScreen1 = new Screen2();
    playScreen1.PlayScreenOne();
    

    So when I wanted to use the method to play the media player on the second form from the first one, I just needed to use the same instance of Screen2 that I had created to open the form to begin with instead of created a new instance for what method I wanted to use.

    IDK if my explanation makes sense, or maybe its basics to most people (I'm a noob), but if anyone comes across this problem, message me and I'll try to help.

    o7