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


Java MediaPlayer.getStatus方法代碼示例

本文整理匯總了Java中javafx.scene.media.MediaPlayer.getStatus方法的典型用法代碼示例。如果您正苦於以下問題:Java MediaPlayer.getStatus方法的具體用法?Java MediaPlayer.getStatus怎麽用?Java MediaPlayer.getStatus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.media.MediaPlayer的用法示例。


在下文中一共展示了MediaPlayer.getStatus方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: syncControlPlayPause

import javafx.scene.media.MediaPlayer; //導入方法依賴的package包/類
private void syncControlPlayPause() {
    MediaPlayer player = playerProperty.getValue();
    if (player == null) {
        if (controlPlayPause.isSelected()) {
            controlPlayPause.setSelected(false);
        }
    } else {
        if (player.getStatus() == Status.PLAYING) {
            double ct = player.getCurrentTime().toMillis();
            double mt = player.getTotalDuration().toMillis();
            if (ct < mt) {
                if (!controlPlayPause.isSelected()) {
                    controlPlayPause.setSelected(true);
                }
            } else {
                if (controlPlayPause.isSelected()) {
                    controlPlayPause.setSelected(false);
                }
            }
        } else {
            if (controlPlayPause.isSelected()) {
                controlPlayPause.setSelected(false);
            }
        }
    }
}
 
開發者ID:brightgenerous,項目名稱:fx-player,代碼行數:27,代碼來源:PlayList.java

示例2: setVolumeForAllSounds

import javafx.scene.media.MediaPlayer; //導入方法依賴的package包/類
/**
 * Sets the volume for all sounds controlled by {@link SuperSoundManager}.
 *
 * @param volume
 *            The new volume to set immediately for all controlled sounds.
 */
public static void setVolumeForAllSounds(double volume) {
	MediaPlayer[] snapshotOfAllSounds = allControlledSounds.toArray(new MediaPlayer[0]);
	for (MediaPlayer sound : snapshotOfAllSounds) {
		if (sound.getStatus() != Status.DISPOSED)
			sound.setVolume(volume);
	}
}
 
開發者ID:ubershy,項目名稱:StreamSis,代碼行數:14,代碼來源:SuperSoundManager.java

示例3: stopAllSounds

import javafx.scene.media.MediaPlayer; //導入方法依賴的package包/類
/**
 * Stops all sounds controlled by {@link SuperSoundManager}.
 *
 * @return True, if at least one sound was stopped. False, if no sounds were playing at the
 *         moment.
 */
public static boolean stopAllSounds() {
	MediaPlayer[] snapshotOfAllSounds = allControlledSounds.toArray(new MediaPlayer[0]);
	boolean atLeastOneStopped = false;
	for (MediaPlayer sound : snapshotOfAllSounds) {
		Status status = sound.getStatus();
		if (status != Status.DISPOSED && status != Status.STOPPED) {
			sound.stop();
			atLeastOneStopped = true;
		}
	}
	return atLeastOneStopped;
}
 
開發者ID:ubershy,項目名稱:StreamSis,代碼行數:19,代碼來源:SuperSoundManager.java

示例4: controlHead

import javafx.scene.media.MediaPlayer; //導入方法依賴的package包/類
@FXML
protected void controlHead() {
    MediaPlayer player = playerProperty.getValue();
    if (player == null) {
        return;
    }
    Status status = player.getStatus();
    if ((status != Status.UNKNOWN) && (status != Status.DISPOSED)) {
        player.seek(Duration.millis(0));
    }
}
 
開發者ID:brightgenerous,項目名稱:fx-player,代碼行數:12,代碼來源:PlayList.java

示例5: checkInfoOnEvent

import javafx.scene.media.MediaPlayer; //導入方法依賴的package包/類
private boolean checkInfoOnEvent(MediaInfo info, MediaPlayer mp) {
    if (info != currentInfoProperty.getValue()) {

        log("WARNING!!! : targetInfo != current");

        if ((mp != null) && (mp.getStatus() != Status.DISPOSED)) {
            mp.dispose();
        }
        return false;
    }
    return true;
}
 
開發者ID:brightgenerous,項目名稱:fx-player,代碼行數:13,代碼來源:PlayList.java


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