當前位置: 首頁>>代碼示例>>Java>>正文


Java MediaPlayer.pause方法代碼示例

本文整理匯總了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();
		}
	};
	
}
 
開發者ID:GeePawHill,項目名稱:contentment,代碼行數:20,代碼來源:MediaRhythm.java

示例2: stopTrailer

import javafx.scene.media.MediaPlayer; //導入方法依賴的package包/類
private void stopTrailer() {
    MediaPlayer mediaPlayer = mediaView.getMediaPlayer();
    if (mediaPlayer != null) {
        mediaPlayer.pause();
        mediaPane.setVisible(false);
    }
}
 
開發者ID:hendrikebbers,項目名稱:ExtremeGuiMakeover,代碼行數:8,代碼來源:MasterDetailViewController.java

示例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();
	}
}
 
開發者ID:cookerlyk,項目名稱:missile-defense,代碼行數:7,代碼來源:AudioPlayer.java

示例4: stopMediaPlayer

import javafx.scene.media.MediaPlayer; //導入方法依賴的package包/類
private void stopMediaPlayer() {
    MediaPlayer mediaPlayer = mediaView.getMediaPlayer();
    if (mediaPlayer != null) {
        mediaPlayer.pause();
    }
}
 
開發者ID:hendrikebbers,項目名稱:ExtremeGuiMakeover,代碼行數:7,代碼來源:MovieViewSkin.java

示例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();
	
}
 
開發者ID:GeePawHill,項目名稱:contentment,代碼行數:46,代碼來源:VideoPlayerExperiment.java

示例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);
	}
 
開發者ID:stevengalarza,項目名稱:aurous-app,代碼行數:49,代碼來源:MediaPlayerScene.java


注:本文中的javafx.scene.media.MediaPlayer.pause方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。