本文整理匯總了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);
}
}
}
}
示例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);
}
}
示例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;
}
示例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));
}
}
示例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;
}