title: How can you Embed YouTube Video using JOGL
body: <p>I am working on adding cutscenes to a game mod I am writing. The game renders GUI elements using JOGL, so I have created a render event for the Player's Heads Up Display (HUD) and I want to render an overlay on this HUD which plays an embedded youtube video and then cancel the render once the youtube video stops.</p>
  <pre><code>@SubscribeEvent(priority=EventPriority.LOWEST)
  public void onRender(RenderGameOverlayEvent.Post event) {
      player = mc.thePlayer;
      int height = event.resolution.getScaledHeight();
      int width = event.resolution.getScaledWidth();
                  
      if(isVisible){
          GL11.glPushMatrix();
          this.mc.getTextureManager().bindTexture(texture);
          drawPlayerHUD(videoCutScenePath, width, height, event);
          GL11.glEnable(GL11.GL_BLEND);
          GL11.glDisable(GL11.GL_DEPTH_TEST);
          GL11.glDepthMask(false);
          GL11.glColor4f(1.0F, 1.0F, 1.0F, guiOpacity);
          GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
          GL11.glPopMatrix(); 
      }
  }
  </code></pre>
  <p>When isVisible is set true - play cut scene from embeded youtube video inside the frame. I have access to the resolution of the frame (Height and Width), mouseX, mouseY, partialTick count and I have successfully displayed an image texture in png format on this frame already. I am looking to now render a video from youtube specifically. How would you accomplish this?</p>
  <pre><code>private void drawPlayerHUD(String path, int width, int height, RenderGameOverlayEvent.Post event){                                                      
      //getYouTube video so the onRender method can render it??                                                                                             
  }
  </code></pre>
  <p>[Edit] I have tried to open the Youtube URL using the following method which also returns the status for debugging purposes and this works but it opens in a new window. I now want to merge the two and am unsure how.</p>
  <pre><code>  public static String openWebpage() {                                 
     if (Desktop.isDesktopSupported()) {
         try {
          Desktop.getDesktop().browse(new URI(&quot;https://www.youtube.com/watch_popup?v=[videoID]?&amp;autoplay=1&quot;));
         } catch (IOException e) {
          e.printStackTrace();
          return &quot;Can't open browser for some reason&quot;;
         } catch (URISyntaxException e) {
          e.printStackTrace();
          return &quot;Bug Detected: The URL is invalid for some reason.&quot;;
         }
     } else {
     return &quot;For some reason You Can't open the browser&quot;;
    }
    return null;
  }
  </code></pre>