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

In MediaView OnEndOfMedia fails to get called

XMLWordPrintable

      When playing a .mov file on Mac OS X 10.5.5., JDK 1.5, JavaFX SDK b52, the OnEndofMedia fails to get called at the end of the clip. The following code demonstrates this problem.

      import javafx.stage.Stage;
      import javafx.scene.Scene;
      import javafx.scene.text.Text;
      import javafx.scene.text.Font;
      import javafx.scene.media.MediaView;
      import javafx.scene.media.MediaPlayer;
      import javafx.scene.media.Media;
      import javafx.scene.Node;
      import javafx.scene.input.MouseEvent;
      import javafx.scene.*;
      import javafx.scene.shape.*;
      import javafx.scene.paint.*;

      /**
       * @author mgionfriddo
       */

      class Vote extends CustomNode {
          override function create():Node {
              return Group {
                  content: {
                      Rectangle {

                          fill: Color.GREEN
                          x: 150 y: 150
                          width: 50 height: 50
                          arcWidth: 20 arcHeight: 20
                          }
                              
                       Text {
                          x: 175
                          y: 175
                          fill: Color.WHITE
                          font: Font { size: 20 }
                          content: "Vote"
                       }
                  }
              }
          };
      };

      var myScene: Scene = Scene {
          content:
                  MediaView {
                      //translateX: 140
                      fitWidth: 500
                      fitHeight: 300
                      mediaPlayer: bind myPlayer

                      onMouseClicked: function( e: MouseEvent ):Void {
                             println("mouse clicked");
                             insert Vote{} into myScene.content;
                            }
                    }
      }

      var myMedia: Media = Media {
          source: "file:///Users/mgionfriddo/Documents/DisNature_Earth_Spectacle_High.mov"
          };

      var myPlayer: MediaPlayer = MediaPlayer{
                          autoPlay: true
                          media: bind myMedia

                          onEndOfMedia: function():Void {
                              myScene.content = Vote{}
                              println("AFTER VOTE");
                              }
                      };



      Stage {
          title: "glassfish media player"
          width: 500
          height: 300
          scene: myScene
              
      }

            tonywyant Tony Wyant (Inactive)
            mgionfridjfx Mike Gionfriddo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: