This discussion is archived
0 Replies Latest reply: Jun 21, 2012 4:12 AM by 945054 RSS

Two videos in the same MediaView

945054 Newbie
Currently Being Moderated
Hi,
ill try to explain my problem:

i have a code to make a player with 3 diferent videos. The problem is that i dont know how to change from one video to another. I have a "next" button, and in that button i do this:
            player.stop();
            objplaying++;
            central.getChildren().clear();
            player = new MediaPlayer(medias.get(objplaying));
            view = new MediaView(player);
            central.getChildren().add(view);
            System.out.println("Next: "+player.getStatus());
            player.play();
What i do there is:
- Stop the player (which is a mediaplayer)
- erase all from the Pane central
- put in the player the new media with the new video
- Add the MediaView view to the pane and then play it.

It does works, but only sometimes, other times the video wont pass UKNOWN status. It does not happen in every video or always to the same video, happen sometimes.
I dont know if thats the way to change between videos, but i cant find an example how to do it

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points