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

MediaPlayer's currentTime property is not updated on the JavaFX application thread

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • fx2.1
    • fx2.0.2
    • javafx
    • Mac OS X with JavaFX 2.1 preview, Windows 7 with Java 6 u29 and JavaFX 2.0.2.

    Description

      Updating MediaPlayer properties on a background thread causes exceptions to be thrown when those properties are bound to scene graph nodes. The following example program demonstrates the bug:

      public class CurrentTimeUpdatedOffAppThread extends Application {

        public static void main(String[] args) {
          launch(args);
        }
        
        @Override
        public void start(Stage primaryStage) {
          System.out.println("JavaFX version: "+VersionInfo.getRuntimeVersion());
          Media m = new Media("http://traffic.libsyn.com/dickwall/JavaPosse373.mp3");
          MediaPlayer mp = new MediaPlayer(m);

          Label label = new Label();
          label.textProperty().bind(Bindings.convert(mp.currentTimeProperty()));
          
          final Scene scene = new Scene(new Group(label), 200, 200);
          
          primaryStage.setScene(scene);
          primaryStage.setTitle("CurrentTime Bug");
          primaryStage.show();
          
          mp.play();
        }
      }

      After a few seconds, the media will begin to play and an exception will be thrown.

      Attachments

        Issue Links

          Activity

            People

              bpb Brian Burkhalter
              diversonjfx Dean Iverson (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported: