1 Reply Latest reply: Mar 8, 2013 10:56 AM by Marcello RSS

    MediaPlayer not playing video -- no errors and no exceptions

    Marcello
      The situation is: on my application almost all movies are playing correctly. In some environment the movie is not playing, the screen keeps black BUT I do not get any errors or exceptions


      All works fine on Win7, winXP
      However when I deploy my app on "Windows7 embedded", then one of my movies is not getting played. Can this be because of missing codecs or memory issues or JDK version?
      Nevertheless there should be at least some error or exception !?
      How can I figure out whether a movie is getting played or not (and if not where can I fing the reason?)

      Please advise, thanks

      Below is th code that I am using:
      final Media media = new Media(      url          );
                media.setOnError( new Runnable(){     
                               @Override
                               public void run() {
                                    player.stop();     
                                                      System.out.println("error 1");                         
                               }                         
                          });
                          
                          if (media.getError() != null){
                               System.out.println( "EventshowingNode.show( media.getError..)", media.getError());
                               return;
                          }                    
                          if ( player != null)
                               player.stop();
                                              
                          player = new MediaPlayer(     media);
                          player.setMute( true);
                          player.setAutoPlay( false);
                          mediaView.setMediaPlayer( player);
                          
                          double w= media.getWidth();
                          double h= media.getHeight();
                          player.setOnError( new Runnable(){
      
                               @Override
                               public void run() {
                                    player.stop();                              
                                                      System.out.println("error 2");
                                    //handler.onFinishedEvent();
                               }
                               
                          });
                          
                        player.play();
                        player.setOnEndOfMedia( new Runnable() {
                               
                               @Override
                               public void run() {
                                    ;//
                                    
                               }
                          });
      Edited by: Marcello on 06.03.2013 02:23
        • 1. Re: MediaPlayer not playing video -- no errors and no exceptions
          Marcello
          The player remains in Status.UNKNOWN and won't become Status.READY

          My workaround is: Starting a watchdog when loading the media and if the state of the player is still Status.UNKNOWN after (e.g. 3 seconds), then I can process the the case when a movie cannot become played (for whatever reason..)

          Is there a better way to achive the same ?

          (The movie file is a local file on the HD)