@Override public void playing(MediaPlayer mediaPlayer) { renderer.setState(RendererState.PLAYING); long position = getSeekPosition(); if (position > 0) { mediaPlayer.setTime(position); } }
@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); } }
@Override public void error(MediaPlayer mediaPlayer) { renderer.setState(RendererState.ERROR); PlayBlock.log(Level.INFO, "Media has encountered an error!"); }
@Override public void stopped(MediaPlayer mediaPlayer) { renderer.setState(RendererState.STOPPED); }
@Override public void paused(MediaPlayer mediaPlayer) { renderer.setState(RendererState.PAUSED); }
@Override public void opening(MediaPlayer mediaPlayer) { renderer.setState(getPrimaryState()); }
@Override public void buffering(MediaPlayer mediaPlayer, float newCache) { // This would override a PLAYING state renderer.setState(getPrimaryState()); }