Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8105996

MediaPlayer doesn't see end of jar-based media?

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P1 P1
    • fx1.0
    • fx1.0
    • javafx
    • Windows Vista SP1, Java 6u10

      I have a Simple Music Player program that works perfectly if the media url is just file://..., but if the media url is {__DIR__}... (and in my case the app is in a jar file), then the song plays fine but the player does not stop at the end of the song. The problem is not that the duration is wrong, though -- it's still correct. For some reason with {__DIR__} the player doesn't seem to realize that it has hit the end of the song; onEndOfMedia is not called, and updates to currentTime continue to be made, driving it past the song's duration. Just to be clear, this is what I'm talking about:

      var music = Media {
          source: "{__DIR__}resources/music.mp3"
      // source: "file://c:/cygwin/tmp/music.mp3"
          onError: handleError
      }

      There is another detail which might be related. In my sample program I can see that currentTime progresses from 0.0 to about 0.2 or 0.3 and then mysteriously jumps back to 0.0 before marching past the end of the media. That mysterious jog back to 0.0 does not happen with file:// URIs.

      The jar file for the app, which contains the music.mp3 file, is attached.

            bpb Brian Burkhalter
            nsterlinsunw Nicholas Sterling (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: