本文整理匯總了Java中javafx.scene.media.MediaPlayer.pause方法的典型用法代碼示例。如果您正苦於以下問題:Java MediaPlayer.pause方法的具體用法?Java MediaPlayer.pause怎麽用?Java MediaPlayer.pause使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.media.MediaPlayer
的用法示例。
在下文中一共展示了MediaPlayer.pause方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: MediaRhythm
import javafx.scene.media.MediaPlayer; //導入方法依賴的package包/類
public MediaRhythm(String mediaString)
{
Media m = new Media(mediaString);
mediaPlayer = new MediaPlayer(m);
mediaPlayer.pause();
beatProperty = new SimpleLongProperty(0L);
isPlaying = false;
startedPauseAt = 0L;
timer = new AnimationTimer()
{
@Override
public void handle(long now)
{
update();
}
};
}
示例2: stopTrailer
import javafx.scene.media.MediaPlayer; //導入方法依賴的package包/類
private void stopTrailer() {
MediaPlayer mediaPlayer = mediaView.getMediaPlayer();
if (mediaPlayer != null) {
mediaPlayer.pause();
mediaPane.setVisible(false);
}
}
示例3: pauseSound
import javafx.scene.media.MediaPlayer; //導入方法依賴的package包/類
public void pauseSound(String folder, String filename) {
MediaPlayer mp = findSound(folder, filename);
if(mp != null) {
mp.pause();
}
}
示例4: stopMediaPlayer
import javafx.scene.media.MediaPlayer; //導入方法依賴的package包/類
private void stopMediaPlayer() {
MediaPlayer mediaPlayer = mediaView.getMediaPlayer();
if (mediaPlayer != null) {
mediaPlayer.pause();
}
}
示例5: start
import javafx.scene.media.MediaPlayer; //導入方法依賴的package包/類
@Override
public void start(Stage stage) throws Exception
{
Media media = new Media(new File("../core/src/main/resources/blackHandbraked.mp4").toURI().toString());
MediaPlayer player = new MediaPlayer(media);
player.pause();
player.setCycleCount(Integer.MAX_VALUE);
MediaView mediaView = new MediaView(player);
mediaView.setFitWidth(1280d);
BorderPane pane = new BorderPane();
pane.setCenter(mediaView);
ToolBar tools = new ToolBar();
Text total = new Text("TOTAL");
total.setStroke(Color.WHITE);
total.setFill(Color.BLUE);
total.setFont(new Font("Buxton Sketch",60d));
tools.getItems().add(total);
Text time = new Text("HI MOM!");
time.setStroke(Color.WHITE);
time.setFill(Color.BLUE);
time.setFont(new Font("Buxton Sketch",60d));
tools.getItems().add(time);
pane.setTop(tools);
player.currentTimeProperty().addListener(new ChangeListener<Duration>() {
@Override
public void changed(ObservableValue<? extends Duration> observable, Duration oldValue, Duration newValue)
{
double elapsed = ((double)player.getCurrentCount())*player.getCycleDuration().toMillis()+newValue.toMillis();
time.setText(""+elapsed);
total.setText(player.getCycleDuration().toString());
}
});
player.setOnEndOfMedia(() -> System.out.println("End"));
stage.setScene(new Scene(pane));
stage.show();
player.play();
}
示例6: createScene
import javafx.scene.media.MediaPlayer; //導入方法依賴的package包/類
public Scene createScene(final String sourceURL) throws Throwable {
final Group root = new Group();
root.autosize();
MediaUtils.activeMedia = sourceURL;
final String trailer = MediaUtils.getMediaURL(sourceURL);
media = new Media(trailer);
player = new MediaPlayer(media);
view = new MediaView(player);
view.setFitWidth(1);
view.setFitHeight(1);
view.setPreserveRatio(false);
// System.out.println("media.width: "+media.getWidth());
final Scene scene = new Scene(root, 1, 1, Color.BLACK);
player.play();
player.setOnReady(() -> {
ControlPanel.seek().setValue(0);
});
player.currentTimeProperty().addListener(
(observableValue, duration, current) -> {
final long currentTime = (long) current.toMillis();
final long totalDuration = (long) player.getMedia()
.getDuration().toMillis();
updateTime(currentTime, totalDuration);
});
// PlayerUtils.activeYoutubeVideo = youtubeVideo;
if (sourceURL.equals("https://www.youtube.com/watch?v=kGubD7KG9FQ")) {
player.pause();
}
UISession.setMediaPlayer(player);
UISession.setMediaView(view);
UISession.setMedia(media);
return (scene);
}