// private static StreamFunctions sFunctions = new StreamFunctions();
public MediaView view;
public Scene createScene(final String sourceURL) throws Throwable {
final ControlPanel panel = UISession.getControlPanel();
final Group root = new Group();
root.autosize();
MediaUtils.activeMedia = sourceURL;
final String trailer = MediaUtils.getMediaURL(sourceURL);
try {
media = new Media(trailer.trim());
} catch (final Exception e) {
MediaUtils.handleEndOfStream();
}
player = new MediaPlayer(media);
view = new MediaView(player);
view.setFitWidth(1);
view.setFitHeight(1);
view.setPreserveRatio(false);
// System.out.println("media.width: "+media.getWidth());
final Scene scene = new Scene(root, 1, 1, Color.BLACK);
// player.play();
player.setOnReady(() -> {
player.setAutoPlay(false);
panel.seek().setValue(0);
if (sourceURL
.contains("https://www.youtube.com/watch?v=kGubD7KG9FQ")) {
player.pause();
} else {
player.play();