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

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

    XMLWordPrintable

    Details

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

      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

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

                Dates

                Created:
                Updated:
                Resolved:
                Imported: