public void switchManually() { checkEDT(); if (manualTempURL == null) { stop(); return; } JComponent component = player.getComponent(); player.setComponent(null); manualTempPlayer.setComponent(component); player.stop(); player = manualTempPlayer; image = player.getImage(); currentUrl = manualTempURL; }
public void stop() { SwingUtilities.invokeLater( () -> { if (player != null) { player.stop(); } currentUrl = null; }); }
public VideoVLCWidget(int x, int y, int width, int height, int sleepTime, long updateWait) { super(updateWait); this.x = x; this.y = y; this.width = width; this.height = height; player = new PlayerInImage(width, height, null, null); image = player.getImage(); this.sleepTime = sleepTime; ready = true; }
public void change(String url) { log.info("Change to " + url); SwingUtilities.invokeLater( () -> { if (url == null) { currentUrl = null; stop(); return; } ready = false; PlayerInImage player2 = new PlayerInImage(width, height, null, url); Timer timer = new Timer( sleepTime, (a) -> { JComponent component = player.getComponent(); player.setComponent(null); player2.setComponent(component); inChange = true; player.stop(); player = player2; image = player2.getImage(); ready = true; currentUrl = url; }); timer.setRepeats(false); timer.start(); }); }
public void setVolume(int volume) { checkEDT(); player.setVolume(volume); }
public void draw(Graphics g, int x, int y, int width, int height) { g.drawImage(player.getImage(), x, y, width, height); }
public void draw(Graphics g) { g.drawImage(player.getImage(), x, y, this.width, this.height); }
public double getAspectRatio() { return player.getPlayer().getAspectRatio().equals("16:9") ? 16. / 9 : 4. / 3; }