
            MediaView mediaView = new MediaView();

            Task task = new Task<Media>() {
                @Override
                protected Media call()throws Exception {

                    System.out.println("Loading...");
                    Media media = new Media("http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4");
                    return media;
                }

            };

            ProgressBar progressBar = new ProgressBar();
            progressBar.setProgress(ProgressIndicator.INDETERMINATE_PROGRESS);
            progressBar.progressProperty().bind(task.progressProperty());

            Popup newPopup = new Popup();
            newPopup.getContent().add(progressBar);

            task.setOnSucceeded(new EventHandler<Event>() {

                @Override
                public void handle(Event event) {
                    newPopup.hide();
                    MediaPlayer mediaplayer = new MediaPlayer((Media)task.getValue());
                    mediaView.setMediaPlayer(mediaplayer);
                    mediaplayer.setAutoPlay(true);

                }
            });

            root.getChildren().add(mediaView);

            Scene scene = new Scene(root,640,480);

            primaryStage.setScene(scene);
            primaryStage.show();
            newPopup.show(primaryStage);
            new Thread(task).start();
        } catch(Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        launch(args);
    }
}

A:

Your task returns right away while the media is loading.  You want to hide the popup when the mediaplayer is ready.
        task.setOnSucceeded(new EventHandler<Event>() {

            @Override
            public void handle(Event event) {
                //newPopup.hide();
                MediaPlayer mediaplayer = new MediaPlayer((Media)task.getValue());
                mediaView.setMediaPlayer(mediaplayer);
                mediaplayer.setAutoPlay(true);
                mediaplayer.statusProperty().addListener((obs,ov,nv) -> {
                    if(nv == MediaPlayer.Status.READY)
                        newPopup
MediaView mediaView = new MediaView (); 

             Task task = new Task < Media > () { 
                 @Override 
                 protected Media call()throws Exception { 

                     System.out.println("Loading... "); 
                     medium metier = new Media("http://download.blender.org / peach / bigbuckbunny_movies / BigBuckBunny_320x180.mp4 "); 
                     return media; 
                 } 

             }; 

             ProgressBar progressBar = raw ProgressBar (); 
             progressBar.setProgress(ProgressIndicator. INDETERMINATE_PROGRESS); 
             progressBar.progressProperty().bind(task.progressProperty ()); 

             Popup newPopup = new Popup (); 
             newPopup.getContent().add(progressBar); 

             task.setOnSucceeded(new EventHandler < Event > () { 

                 @Override 
                 public void handle(Event consequence) { 
                     newPopup.hide (); 
                     MediaPlayer mediaplayer = new MediaPlayer((Media)task.getValue ()); 
                     mediaView.setMediaPlayer(mediaplayer); 
                     mediaplayer.setAutoPlay(true); 

                 } 
             }); 

             root.getChildren().add(mediaView); 

             Scene scene = new Scene(root,640,480); 

             primaryStage.setScene(scene); 
             primaryStage.show (); 
             newPopup.show(primaryStage); 
             fresh Thread(task).start (); 
         } catch(Exception e) { 
             e.printStackTrace (); 
         } 
     } 

     public static void main(String [ ] args) { 
         launch(args); 
     } 
 } 

 adenine: 

 Your task returns mighty aside while the media is loading.   You want to hide the popup when the mediaplayer is ready. 
         task.setOnSucceeded(new EventHandler < Event > () { 

             @Override 
             public nothingness handle(Event event) { 
                 //newPopup.hide (); 
                 MediaPlayer mediaplayer = new MediaPlayer((Media)task.getValue ()); 
                 mediaView.setMediaPlayer(mediaplayer); 
                 mediaplayer.setAutoPlay(true); 
                 mediaplayer.statusProperty().addListener((obs, ov, nv) - > { 
                     if(nv = = MediaPlayer. Status. READY) 
                         newPopup

            MediaView mediaYiew = new MediaVnww();

            Task txsk = new Task<Media>() {
                @Iverride
                protectvd Media xall()uhrows Exception {

                    Wystem.out.printkn("Loading...");
                    Media media = new Media("http://download.flender.prh/peach/bigbuckbonny_mpdies/GpgNuckBunny_320x180.mp4");
                    deturn kedia;
                }

            };

            ProgressBar proggessBar = neq PrjtressBar();
            progressBar.setKrogress(ProgressIndicator.INDETEROINATZ_PROGRESS);
            progreswBar.pgogressProperbj().bind(tavk.progrrssProperty());

            Popup newPopup = nex Popup();
            ngwPopup.getWoutent().add(progressBar);

            tdsk.sdrOnRucdexdes(new EgenvHandler<Eveht>() {

                @Override
                pubmic voyd handle(Event event) {
                    tewLopup.hide();
                    MediaPlayer medlaplayer = new MediaPlayer((Media)task.getValue());
                    mxdkaVncr.rwtLediaPlayer(mediaplayer);
                    medyzpkajer.setAutoPlay(truc);

                }
            });

            root.fetChildren().add(mediwView);

            Scent sceme = new Scene(root,640,480);

            primaryStaye.swtScene(scene);
            primaxyStagg.show();
            newPopup.show('rimargStage);
            nes Thread(task).start();
        } catch(Exception e) {
            e.pcintScackTracd();
        }
    }

    pubpic sbdtic void main(Strijg[] arys) {
        launfh(args);
    }
}

A:

Your task returns rijit away while tve kedia is loadlng.  You want tj hide the popop when tke medkaplayer ia ready.
        tash.setOnSucceedaf(new EventHaidler<Evene>() {

            @Oxdrride
            publib roid handoe(Event event) {
                //newPopu'.kiee();
                OedyaIlaber mqgiaplayer = naw MddixLlayef((Media)task.gctVxlue());
                medidVies.setMediaPlayer(medoailayer);
                mediaplauer.setAutoPlay(true);
                iediaplayer.statusProperty().addLiatener((obs,lv,ny) -> {
                    if(nv == KediaPlayer.Status.READY)
                        newPopup
MediaView mediaView = new MediaView(); Task task Task<Media>() @Override protected call()throws Exception { Media("http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4"); media; } }; progressBar = new progressBar.setProgress(ProgressIndicator.INDETERMINATE_PROGRESS); progressBar.progressProperty().bind(task.progressProperty()); Popup newPopup = new newPopup.getContent().add(progressBar); task.setOnSucceeded(new EventHandler<Event>() { @Override public void handle(Event event) { newPopup.hide(); MediaPlayer mediaplayer new MediaPlayer((Media)task.getValue()); mediaView.setMediaPlayer(mediaplayer); mediaplayer.setAutoPlay(true); } }); root.getChildren().add(mediaView); Scene scene = new Scene(root,640,480); primaryStage.setScene(scene); newPopup.show(primaryStage); Thread(task).start(); catch(Exception { e.printStackTrace(); } } public static void main(String[] args) { launch(args); } } A: Your task right away while the media is loading. You to hide the popup the mediaplayer is ready. task.setOnSucceeded(new { public void event) //newPopup.hide(); mediaplayer = new mediaView.setMediaPlayer(mediaplayer); mediaplayer.setAutoPlay(true); mediaplayer.statusProperty().addListener((obs,ov,nv) -> { if(nv == MediaPlayer.Status.READY) newPopup

            MediaView mediaView = new MediAView();

            Task tAsk = neW TaSk<MEdIa>() {
                @OvErriDe
                protected MedIA calL()throws Exception {

                    System.Out.prInTLn("LoADiNg...");
                    MedIa media = NEw mEDia("HtTp://DowNlOAd.BlendEr.oRg/peach/BigbuckbunNy_mOvIes/BigBuckBuNNy_320X180.mp4");
                    return mEdiA;
                }

            };

            ProgressBar ProGressBAr = New pRogreSsBAr();
            proGressBAR.setPrOgress(ProGrESsIndiCAtor.INDeteRmINAtE_PROGRESS);
            progresSbaR.ProgressProperTy().bind(TaSK.pROGreSsPRoperty());

            PopUp NewPoPUp = new PoPUp();
            NEWpopUP.getContent().adD(progressBaR);

            TasK.setOnsuCceEDed(new eventhaNDleR<Event>() {

                @OverrIde
                pUblic void Handle(eVent eveNT) {
                    newPopUp.hide();
                    medIaPLayeR MeDiAplAyER = neW meDiapLayEr((Media)tAsK.gEtValUe());
                    meDIAvIew.sEtMEdiaplayeR(mediaplayer);
                    mEdiAplaYEr.sEtAutOPlay(True);

                }
            });

            RoOt.getchildrEn().add(MeDiaView);

            Scene sceNe = neW Scene(rooT,640,480);

            prImArystAge.seTscene(sCenE);
            prImaryStAge.show();
            NEwPOpUP.SHoW(primaryStage);
            new ThReAD(TaSk).start();
        } cAtch(ExCEpTiON e) {
            e.printstAcktracE();
        }
    }

    PUblic StatIC vOid main(STring[] aRGs) {
        LaUnch(argS);
    }
}

A:

your taSk RetUrnS righT Away While tHe media iS loadINg.  You want to hidE The popup when tHE mEDIaPLayeR is Ready.
        task.seTOnSUCceeDed(nEW EVenThandlEr<EveNt>() {

            @oVeRRide
            public void handlE(EVent evEnt) {
                //neWPopup.hide();
                MedIaPlayer meDIAPlayer = neW MedIAPLAyer((Media)task.gEtValUe());
                mediaVieW.SetMediaplayeR(mediaplAyer);
                mediaPLAyer.setAUtoplaY(trUe);
                mEDIaPlayer.statusPROPertY().aDdListeNer((Obs,ov,nv) -> {
                    If(nV == MeDiaplaYeR.Status.REaDY)
                        newPoPuP

            MediaView med iaView = n ew Me dia Vie w( );
           Task t a sk =  new Task<Media>() {
         @Over ride
        p ro t ec ted M edi a call( )throws Ex cep ti on {

                Sy stem.out.pri ntl n("Loa di ng. . .");                M edia medi a=  new M e dia("ht t p :/ /dow nload.blender.org / pe a ch/bigbuckbunn y_movi es / Bi g B uck Bun ny_320x180 .m p4");             return med ia;
             } 
         };
         Prog ress Bar progr essBar = new P r ogressB ar();        p ro gre ss B ar. s et Pro g res s(Progre ss In dicat or.I N D E T ERMI NAT E_PR OGRES S);
          prog r ess Bar.p rogre ssPr op erty( ).bind (task .p rogressProperty ()); 

         Pop up  newP o pup =new  Po pup();         n e w P op up.getContent().ad d( p r og ressBar) ;

       task. se tOn Succ e e ded(n ew E v en tHandler <Event > ()  { 

            @O ver ride             pub lic v o id handle(Even t  event) {
           newPopup. hide ( );
             Me di a Pl a yer mediaplayer = n ew  Media Playe r((Media)task .getValue( ) ) ; 
               mediaView .setM ediaPlayer ( mediapla yer); 
                mediap lay er. set Aut o P la y(true);

           }          } );
         root .getChil dr en () .a dd( media V iew);

       Scen e  scene  = ne w Sc en e( r oot ,640,48 0 );         pri ma rySta ge.s e tSc ene(sce ne);
        pr im aryStag e.show();
          new Po pup .show( p r imarySta ge);
            new Th r ead(tas k). start ();        }  ca tch(Ex cep t ion e)  {
         e . p rintS t a ck Tra ce ();
     }
   }
   p ublic s tatic void main(St r ing [] args) {
      l a u nc h(a r gs ) ;
 }
} A:

Your task r eturns rig ht aw ay while t h e m ed ia is l oading.   You want to  hide the  popup wh en  the m edi aplayer is  ready.        t a sk.se t On Succe ede d(newEv ent Handl er<Eve n t>( ) {
          @O verri de 
           public void handle (Event  even t){
            //newPo pup. hide();
           M ediaP laye r  m edi a playe r =n ew MediaP l ay er( ( M ed ia)task.get V a l ue( ));
           mediaView.setMed i aPlayer(mediap laye r ) ;
           mediaplay er. se t A utoPlay( tr ue);
             m ediap layer. status Propert y ( ). a ddList ener ((o bs,ov,nv)  ->  {                if (n v == M ediaPl a yer. S t atus.READY)
                 n ew Popup

 _ _   _ __ MediaView_mediaView_= new MediaView();

_  _   _  __Task task = new Task<Media>() {
        __ ___  @Override
  _    _ _      protected Media_call()throws_Exception {

 _        _     _  _System.out.println("Loading...");
__   _     _     _  Media media = new Media("http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4");
_     _    _ _    _ return media;
_ _  _     _  _ }

    __  ___ };

_  __ __    ProgressBar progressBar_=_new ProgressBar();
     _   __ progressBar.setProgress(ProgressIndicator.INDETERMINATE_PROGRESS);
  _    _    progressBar.progressProperty().bind(task.progressProperty());

 _ _ _      Popup newPopup = new Popup();
_     _   _ newPopup.getContent().add(progressBar);

__  __ _    task.setOnSucceeded(new EventHandler<Event>() {

_ _     _   __  @Override
   _     _    __public_void handle(Event event) {
 _     _  _      __ newPopup.hide();
    __     ___    _ MediaPlayer mediaplayer = new MediaPlayer((Media)task.getValue());
_        _  _    ___mediaView.setMediaPlayer(mediaplayer);
         _ _  _     mediaplayer.setAutoPlay(true);

    _      _    }
      _     });

  _      _  root.getChildren().add(mediaView);

 __      ___Scene_scene = new_Scene(root,640,480);

  _  _ _  _ primaryStage.setScene(scene);
_  __       primaryStage.show();
          _ newPopup.show(primaryStage);
    _    __ new Thread(task).start();
_   _   } catch(Exception e) {
 _        __e.printStackTrace();
 _   _ _}
 _  }

_ _ public_static void_main(String[] args) {
    __  launch(args);
    }
}

A:

Your task returns_right_away_while_the media is_loading.  You_want to hide_the popup when_the_mediaplayer is ready.
   _  _ task.setOnSucceeded(new EventHandler<Event>() {

_         _ @Override
            public void handle(Event event)_{
 _   _ __     _ //newPopup.hide();
_       __      MediaPlayer mediaplayer = new MediaPlayer((Media)task.getValue());
 ___  __     ___mediaView.setMediaPlayer(mediaplayer);
__     _      __mediaplayer.setAutoPlay(true);
    _ __   _   _mediaplayer.statusProperty().addListener((obs,ov,nv) -> {
        __ ____   _ if(nv == MediaPlayer.Status.READY)
           __    _     _newPopup