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

MediaPlayer seek + setRate combination doesn't work reliable

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: fx2.1, 7u6
    • Fix Version/s: 8
    • Component/s: javafx
    • Environment:

      2.2-b15 and 2.1, Windows 7 x64

      Description

      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.

        Attachments

        1. Bug.java
          2 kB
          Alexander Kuznetcov

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:
              Imported: