Video playback on windows - bug ? JUCE v5.3.2

Hi,
I want my app to playback video, but it only works on Mac.
On windows the problem is always there:

bool createNativeWindow()
{
jassert (nativeWindow == nullptr);

        if (auto* topLevelPeer = component.getTopLevelComponent()->getPeer())
        {
            nativeWindow.reset (new NativeWindow ((HWND) topLevelPeer->getNativeHandle(), this));

            hwnd = nativeWindow->hwnd;

            if (hwnd != 0)
            {
                hdc = GetDC (hwnd);
                component.updateContextPosition();
                component.updateContextVisibility();
                return true;
            }

            nativeWindow = nullptr;
        }
        else
        {
            **jassertfalse;**.  ---->>> ERROR ON WINDOWS :confused:
        }

        return false;
    }

Is this the reason, why video demo is limited in JUCE-DEMO on windows ?

thanks
Jens

Have you tried the latest tip of the develop branch? I fixed a bug in the Windows VideoComponent implementation recently.

Hi,
yes I tried, but still have the same error on windows 10 … (I replaced the new video module with the latest of the develop branch).

regards
Jens

Have you tested this with the VideoDemo in the JUCE DemoRunner? I can load and play .wmv files there with no issues on Windows 10.

Hi,
that’s crazy, in my Demo Runner nothing happens if I press the load button …
I tried 3 different Juce versions. I will try to compile the video demo with Projucer, but need to find all the headers (windows.h) etc…
thanks
Jens

Hi there,
Video.h in Demo-App isn’t working on my windows 10 and Windows Server 2012 (strato) … the buttons have no function, unable to load a video file.
is there someone which has the same problem ?

regards
Jens

Do you get an error message when you click on of the load buttons? It should display an AlertWindow containing the error if there was an issue.

Hi,
No, simply nothing happens. Yesterday i run it debug mode and it does the same: nothing😩
No drag and drop and no button work.
I downloaded the last version (10 hours old or like that).
And in my own code (see above) it stops, when trying to open a videofile.

The solution is to get this video demo runningšŸ˜‰ then i can look further…

On mac, everything is ok :slight_smile:

Regard
Jens

Hi,
I modified the video demo to open the file-chooser directly. And see it works :-))
It only plays ā€œ.wmvā€ - format at this moment. But great, it works :slight_smile:
For other formats (mov & mp4) there can be downloaded special codecs I guess ? The load-buttons in the video-demo are really not working on my computers !

regards
Jens

1 Like

@jensomat did you ever figure out what the problem is? I have the exact same issue, same jassertfalse getting hit. I’m even having the same trouble with the Video demo on Windows.

Thanks!

Hi,
I never tried to figure out which problem the demo has … but it works in my application.

regards
Jens

If you are trying .mov files I would assume you need Quicktime installed. It is a Codec prominently used by apple, but windows installers are available, so the platform video component, that is used, should be able to use Quicktime.

@jensomat did you have to do something special to get the files loading? the standard method is still hitting that jassertfalse for me.

@daniel i’ve been trying with .wmv, have confirmed the application has the correct path, but, still hitting that jassertfalse

WMV is a container format, like almost every modern video format. So chances are it needs an extra codec installed. Can you please:

  • verify that the video file is not corrupt, by playing in windows media player
  • if it doesn’t play you need to install the codec or the file is broken
  • you can still double check with VLC, which is often more forgiving than other players

The VideoComponent uses the same engine like the WindowsMediaPlayer, so if it doesn’t play there, it can’t play in your app.
I am hesitant to claim the opposite statement though :wink:

thank for the insight, @daniel!

I’ve tested playing the video in WMP, everything loads and runs correctly. still hitting that jassertfalse however.

the URL is returning that it is well-formed (it’s just a C:\ absolute path), does it perhaps need to be in a special scheme for windows? like ā€œfile://ā€?

1 Like

Can you pst exactly the jassert you are hitting and the surrounding code?
Is there a comment?

That is the normal way, how to deal with jasserts:
the designer wanted to rule something out, or wanted to make sure, some pre-conditions are met. Then work your way back, trying to understand, why that variable is not supposed to be in the state, that halted the execution.

same one posted at the top of the forum, looks like there’s no top level peer:

   if (auto* topLevelPeer = component.getTopLevelComponent()->getPeer())
    {
        nativeWindow.reset (new NativeWindow ((HWND) topLevelPeer->getNativeHandle(), this));

        hwnd = nativeWindow->hwnd;

        if (hwnd != 0)
        {
            hdc = GetDC (hwnd);
            component.updateContextPosition();
            component.updateContextVisibility();
            return true;
        }

        nativeWindow = nullptr;
    }
    else
    {
        **jassertfalse;**.  ---->>> ERROR ON WINDOWS :confused:
    }

    return false;
}

Could it be, that you are setting the video in the constructor, before the component is on the screen? That would explain, why it has no peer.

I just tried loading the video in a post-constructor function call (after it has been added to screen) but am still hitting the same jassertfalse

To anyone interested, there appears to be an interval of time you have to wait when setting up the VideoComponent on Windows. On my application, at least, a spinner appears when the component is first drawn to the screen. When the spinner disappears, it is safe to load the content.

Hope that helps anyone reading this.