UI Dialog and JW Player

UI Dialog and JW Player

I have a problem with the Dialog UI and JW Player. I set up a link that when clicked opens a dialog showing the video using JW Player. The problem is that when you first click the link to open the dialog, the dialog window is blank until you actually click and drag the window, then the video shows and plays fine. Does anyone know what could be causing this? Thank you!

I can't provide a link, but here is a screenshot of the empty dialog.




And here is my code:

         <div id="video-player-container">
           <div id="video-player">{() (: This div is filled by the player :)}</div>
           <div id="video-player-modal">{() (: This div is filled by the player :)}</div>
             <script type='text/javascript'>
              var options =
              {{
                playlist:
                  [{{
                      sources: [
                      {{ file: '{$video-rtmp-href}' }},
                      {{ file: '{$video-hls-href}' }}
                      ],
                      image: '{$image-href}'
                  }}],
                  width: '100%',
                  height: '90%',
                  aspectratio: '16:9',
                  primary: "html5",
                  stretching: "fill"
                }};
               
              jwplayer('video-player').setup(options);
             
              function dialogOpen() {{
                $("#video-player-modal").dialog({{
                autoOpen: true,
                resizable: true,
                close: function(event, ui) {{
                   jwplayer("video-player-modal").remove();
                  }},
                open: function(event, ui) {{
                    jwplayer("video-player-modal").setup(options);
                  }}
                }})
              }};
             </script>
             <div id="video-dialog-link">
              <a href="javascript:dialogOpen();">
                <img src="/images/video-resize.png"/>
              </a>
             </div>
           </div>