# Video playback on windows - bug ? JUCE v5.3.2

**URL:** <https://forum.juce.com/t/video-playback-on-windows-bug-juce-v5-3-2/28686>\
**Category:** Windows\
**Created:** [July 23, 2018, 9:03pm UTC](https://forum.juce.com/t/video-playback-on-windows-bug-juce-v5-3-2/28686 "2018-07-23T21:03:07Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![jensomat](https://avatars.discourse-cdn.com/v4/letter/j/96bed5/32.png) [@jensomat](https://forum.juce.com/u/jensomat)\
**Post date:** [July 23, 2018, 9:03pm UTC](https://forum.juce.com/t/video-playback-on-windows-bug-juce-v5-3-2/28686/1 "2018-07-23T21:03:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ed95](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ed95/32/7635_2.png) [@ed95](https://forum.juce.com/u/ed95)\
**Post date:** [July 24, 2018, 7:52am UTC](https://forum.juce.com/t/video-playback-on-windows-bug-juce-v5-3-2/28686/2 "2018-07-24T07:52:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jensomat](https://avatars.discourse-cdn.com/v4/letter/j/96bed5/32.png) [@jensomat](https://forum.juce.com/u/jensomat)\
**Post date:** [July 24, 2018, 10:34pm UTC](https://forum.juce.com/t/video-playback-on-windows-bug-juce-v5-3-2/28686/3 "2018-07-24T22:34:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ed95](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ed95/32/7635_2.png) [@ed95](https://forum.juce.com/u/ed95)\
**Post date:** [July 25, 2018, 8:00am UTC](https://forum.juce.com/t/video-playback-on-windows-bug-juce-v5-3-2/28686/4 "2018-07-25T08:00:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jensomat](https://avatars.discourse-cdn.com/v4/letter/j/96bed5/32.png) [@jensomat](https://forum.juce.com/u/jensomat)\
**Post date:** [July 25, 2018, 8:43pm UTC](https://forum.juce.com/t/video-playback-on-windows-bug-juce-v5-3-2/28686/5 "2018-07-25T20:43:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jensomat](https://avatars.discourse-cdn.com/v4/letter/j/96bed5/32.png) [@jensomat](https://forum.juce.com/u/jensomat)\
**Post date:** [August 1, 2018, 8:41pm UTC](https://forum.juce.com/t/video-playback-on-windows-bug-juce-v5-3-2/28686/6 "2018-08-01T20:41:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ed95](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ed95/32/7635_2.png) [@ed95](https://forum.juce.com/u/ed95)\
**Post date:** [August 2, 2018, 9:03am UTC](https://forum.juce.com/t/video-playback-on-windows-bug-juce-v5-3-2/28686/7 "2018-08-02T09:03:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jensomat](https://avatars.discourse-cdn.com/v4/letter/j/96bed5/32.png) [@jensomat](https://forum.juce.com/u/jensomat)\
**Post date:** [August 2, 2018, 9:31am UTC](https://forum.juce.com/t/video-playback-on-windows-bug-juce-v5-3-2/28686/8 "2018-08-02T09:31:21Z")

</div>

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 🙂

Regard  
Jens

---

<div class="post-metadata">

**Author:** ![jensomat](https://avatars.discourse-cdn.com/v4/letter/j/96bed5/32.png) [@jensomat](https://forum.juce.com/u/jensomat)\
**Post date:** [August 2, 2018, 10:04pm UTC](https://forum.juce.com/t/video-playback-on-windows-bug-juce-v5-3-2/28686/9 "2018-08-02T22:04:24Z")

</div>

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 🙂  
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

---

<div class="post-metadata">

**Author:** ![collinschupman](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/collinschupman/32/2188_2.png) [@collinschupman](https://forum.juce.com/u/collinschupman)\
**Post date:** [February 14, 2019, 11:42pm UTC](https://forum.juce.com/t/video-playback-on-windows-bug-juce-v5-3-2/28686/10 "2019-02-14T23:42:57Z")

</div>

@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!

---

<div class="post-metadata">

**Author:** ![jensomat](https://avatars.discourse-cdn.com/v4/letter/j/96bed5/32.png) [@jensomat](https://forum.juce.com/u/jensomat)\
**Post date:** [February 15, 2019, 2:39pm UTC](https://forum.juce.com/t/video-playback-on-windows-bug-juce-v5-3-2/28686/11 "2019-02-15T14:39:38Z")

</div>

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

regards  
Jens

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [February 15, 2019, 3:01pm UTC](https://forum.juce.com/t/video-playback-on-windows-bug-juce-v5-3-2/28686/12 "2019-02-15T15:01:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![collinschupman](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/collinschupman/32/2188_2.png) [@collinschupman](https://forum.juce.com/u/collinschupman)\
**Post date:** [February 15, 2019, 5:07pm UTC](https://forum.juce.com/t/video-playback-on-windows-bug-juce-v5-3-2/28686/13 "2019-02-15T17:07:56Z")

</div>

@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

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [February 15, 2019, 5:20pm UTC](https://forum.juce.com/t/video-playback-on-windows-bug-juce-v5-3-2/28686/14 "2019-02-15T17:20:20Z")

</div>

[WMV](https://en.wikipedia.org/wiki/Windows_Media_Video) 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 😉

---

<div class="post-metadata">

**Author:** ![collinschupman](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/collinschupman/32/2188_2.png) [@collinschupman](https://forum.juce.com/u/collinschupman)\
**Post date:** [February 15, 2019, 5:54pm UTC](https://forum.juce.com/t/video-playback-on-windows-bug-juce-v5-3-2/28686/15 "2019-02-15T17:54:35Z")

</div>

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://”?

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [February 15, 2019, 5:59pm UTC](https://forum.juce.com/t/video-playback-on-windows-bug-juce-v5-3-2/28686/16 "2019-02-15T17:59:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![collinschupman](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/collinschupman/32/2188_2.png) [@collinschupman](https://forum.juce.com/u/collinschupman)\
**Post date:** [February 15, 2019, 9:11pm UTC](https://forum.juce.com/t/video-playback-on-windows-bug-juce-v5-3-2/28686/17 "2019-02-15T21:11:24Z")

</div>

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;
}
```

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [February 15, 2019, 9:13pm UTC](https://forum.juce.com/t/video-playback-on-windows-bug-juce-v5-3-2/28686/18 "2019-02-15T21:13:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![collinschupman](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/collinschupman/32/2188_2.png) [@collinschupman](https://forum.juce.com/u/collinschupman)\
**Post date:** [February 15, 2019, 9:44pm UTC](https://forum.juce.com/t/video-playback-on-windows-bug-juce-v5-3-2/28686/19 "2019-02-15T21:44:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![collinschupman](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/collinschupman/32/2188_2.png) [@collinschupman](https://forum.juce.com/u/collinschupman)\
**Post date:** [February 20, 2019, 7:31pm UTC](https://forum.juce.com/t/video-playback-on-windows-bug-juce-v5-3-2/28686/20 "2019-02-20T19:31:15Z")

</div>

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.
