@Override public void finished(MediaPlayer mediaPlayer) { // Used for YouTube videos List<String> subItems = mediaPlayer.subItems(); if (subItems != null && !subItems.isEmpty()) { String subItemURI = subItems.get(0); mediaPlayer.playMedia(subItemURI); } else { renderer.setState(RendererState.STOPPED); } }
public PlayerInImage(int width, int height, JComponent frame, String media) { image = GraphicsEnvironment.getLocalGraphicsEnvironment() .getDefaultScreenDevice() .getDefaultConfiguration() .createCompatibleImage(width, height); image.setAccelerationPriority(1.0f); this.frame = frame; MediaPlayerFactory factory = new MediaPlayerFactory(new String[0]); mediaPlayer = factory.newDirectMediaPlayer(new TestBufferFormatCallback(), new TestRenderCallback()); mediaPlayer.setRepeat(true); // mediaPlayer.addMediaOptions(":file-caching=1500"); // mediaPlayer.setStandardMediaOptions(":file-caching=1500"); // mediaPlayer.setVolume(0); if (media != null) mediaPlayer.playMedia(media, ":file-caching=0"); System.err.println("PLAY!!! " + media); }