@FXML private void Play(MouseEvent event) { if (event.getButton() == MouseButton.PRIMARY) { if (j == 0) { listView.getSelectionModel().select(j); listView.getFocusModel().focus(j); } if (mp != null) { MediaPlayer.Status status = mp.getStatus(); if (status == MediaPlayer.Status.UNKNOWN || status == MediaPlayer.Status.HALTED) { return; } if (status == MediaPlayer.Status.PAUSED || status == MediaPlayer.Status.READY || status == MediaPlayer.Status.STOPPED) { if (atEndOfMedia) { atEndOfMedia = false; } onPlay(); mp.play(); statusDisplay.toBack(); play = true; } else { mp.pause(); statusDisplay.toFront(); play = false; } } } }
@Override public void pauseAudio() { try { myMusician.pause(); } catch (Exception e) { /* does nothing if myMusician is not initialized */ } }
@Override public void play() { if (player != null) { if (isPlaying) { player.pause(); isPlaying = false; log.log(LogType.PLAYER, "Pause"); } else { player.play(); isPlaying = true; log.log(LogType.PLAYER, "Play"); } UIManager.setPlayPauseIcon(isPlaying); } }
void pause(Runnable callback) { if (player != null) { new Tween(player.getVolume()) .tweenToZero( 0.06, 10L, (curVolume) -> { player.setVolume(curVolume); }, (zeroVolume) -> { player.pause(); callback.run(); }); isPlaying = false; } else { callback.run(); } }
private void iniGame() { getImage(); moves = 0; ep = 15; for (int i = 0; i < 16; i++) { iv[i] = new ImageView(IMAGE); iv[i].setViewport(rct[i]); gpane.add(iv[i], i % 4, i / 4); String a = "" + i; iv[i].setId(a); } iv[15].setViewport(rct[16]); exit.setOnMouseClicked( e -> { System.out.println("Exit Successful"); System.exit(1); }); sp.setText("Start"); sp.setOnMouseClicked( e -> { if (done != true) { iv[15].setViewport(rct[15]); randomPic(); gameTimer(); startClick(); songName = new TextField("s.mp3"); songPath = "C:\\Users\\Nihal\\Google Drive\\SCHOOL\\Java 2\\Programs\\JavaFinalProject\\src\\javafinalproject\\"; MiniMP3Player(); mediaPlayer.stop(); mediaPlayer.play(); sp.setOnMouseClicked(null); } }); stop.setOnMouseClicked( e -> { stopGame(); mediaPlayer.pause(); }); }
@Override public void pause() { log.log(LogType.PLAYER, "pause"); player.pause(); }
@FXML public void pauseButton(ActionEvent event) { movie.pause(); }