This discussion is archived
4 Replies Latest reply: Nov 24, 2012 8:39 PM by 805536 RSS

MediaPlayer OnEndOfMedia not working in Webstart application

jrox Newbie
Currently Being Moderated
I have an issue with a Swing/JavaFX application where I'm using the mediaPlayer to play a video. The application works just fine when it is run in my eclipse but as soon as I pack it and upload it to a webserver the video gets played without a problem but the onEndOfMedia Runnable doesn't get triggered anymore. Anyone got a clue how that's possible? Like I said the code works from eclipse and the video itself works also in webstart.

mediaPlayer.setOnEndOfMedia(new Runnable() {
public void run() {
     System.out.println("End of Media!");
// do something
}
});
  • 1. Re: MediaPlayer OnEndOfMedia not working in Webstart application
    jrox Newbie
    Currently Being Moderated
    Has anyone actually tried this and can confirm the issue?
  • 2. Re: MediaPlayer OnEndOfMedia not working in Webstart application
    805536 Journeyer
    Currently Being Moderated
    I didn't have a web server handy to test all environmental variables, but I was able to run my own onEndOfMedia code inside of the HTML file provided in the dist/ folder as well as the "click to launch this app as webstart" link. Worked fine in there. Could you provide us with a self contained sample of your code?

    And you are saying that the video plays in webstart, it just doesn't trigger the onEndOfMedia event, right?
  • 3. Re: MediaPlayer OnEndOfMedia not working in Webstart application
    jrox Newbie
    Currently Being Moderated
    Yes, that is correct!
    Unfortunately I only have a massive project which I can't simply reduce.
  • 4. Re: MediaPlayer OnEndOfMedia not working in Webstart application
    805536 Journeyer
    Currently Being Moderated
    >
    Unfortunately I only have a massive project which I can't simply reduce.
    >

    It's really hard to diagnose something without anything to look at. And if this turns out to be caused by a bug in the library itself as opposed to your own code, the lack of a simple code sample demonstrating the activity that is't working is going to make it difficult to file any bug reports. In the absence of a code sample, I'm going to have to ask quite a lot of questions and the best I'm going to be able to give you is advice, not solutions.

    Does the program work the way you expect it to when you run the files given in the dist/ folder as opposed to your website?

    Where is the video relative to the where the application is run?

    Is whatever you are doing in the onEndOfMedia function something Webstart is allowed and/or able to do? What is supposed to happen when the video is over and what is actually happening?

    Have you given the MediaPlayer any onError functions? Have you gathered data from its other events? What do they say? What is happening up until onEndOfMedia is supposed to be called? What is the value of currentTime compared to the value of totalDuration when the video is nearing the end? What does the status variable indicate? Keep track of all the variables in the MediaPlayer and see if you can find any anomalies.

Legend

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