hello friends i dont know more about jmf i play video using java media framework. now How Can repeat video automatically means video play for ever until usr press stop button thanks
play video using jmf repeat automcatically
1.9k views Asked by pintu At
3
There are 3 answers
0
On
"Reaching the end of play (signaled by an EndOfMedia event) is dealt with by setting the media's own time to zero (back to the start) and restarting the Player" [Book: (Java™ Media APIs: Cross-Platform Imaging, Media, and Visualization)]
In the code below, the object p is a player.
p.addControllerListener(new ControllerListener() {
public void controllerUpdate(ControllerEvent event) {
if (event instanceof EndOfMediaEvent) {
p.setMediaTime(new Time(0));
System.out.println("End of Media – restarting");
p.start();
}
}
});
After creating the player, you could add a ControllerListener. When the file ends an EndOfMediaEvent is generated. When you get that event, you can use the function setMediaTime(0) to start playing the file from the beginning