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

MediaPlayer seek + setRate combination doesn't work reliable

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8
    • fx2.1, 7u6
    • javafx
    • 2.2-b15 and 2.1, Windows 7 x64

      We used MediaPlayer to do slow motion replay and run into the following problem: seek + setRate combination was always changing the rate of the file but it was rewinding to correct position only in 50% of invocations. For the rest of invocations it was either just playing from the beginning or from the current position.

      Here is the code we're using:


             mp.setOnMarker(new EventHandler<MediaMarkerEvent>() {

                  @Override
                  public void handle(MediaMarkerEvent mme) {
                      if (mme.getMarker().getKey().startsWith("Stop")) {
                          if (mp.getRate() == 1) {
                              mp.seek(media.getMarkers().get("Start" + mme.getMarker().getKey().substring(4)));
                              mp.setRate(0.5);
                          } else {
                              mp.pause();
                              scene.setRoot(bpListView);
                          }
                  }
              });

      Video file is H.264 video in mp4 format.

            almatvee Alexander Matveev
            mrkam Alexander Kuznetcov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: