本文整理汇总了Java中org.bff.javampd.MPDPlayer.playNext方法的典型用法代码示例。如果您正苦于以下问题:Java MPDPlayer.playNext方法的具体用法?Java MPDPlayer.playNext怎么用?Java MPDPlayer.playNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bff.javampd.MPDPlayer
的用法示例。
在下文中一共展示了MPDPlayer.playNext方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: nextSong
import org.bff.javampd.MPDPlayer; //导入方法依赖的package包/类
/**
* Performs GET /nextSong
* @return an action result
*/
public static Result nextSong()
{
try
{
MPD mpd = MpdMonitor.getInstance().getMPD();
MPDPlayer player = mpd.getMPDPlayer();
player.playNext();
}
catch (MPDException e)
{
Logger.error("MPD error", e);
flash("error", "Command failed! " + e.getMessage());
}
return ok("");
}
示例2: executePlayerCommand
import org.bff.javampd.MPDPlayer; //导入方法依赖的package包/类
/**
* Executes the given <code>playerCommandLine</code> on the MPD. The
* <code>playerCommandLine</code> is split into it's properties
* <code>playerId</code> and <code>playerCommand</code>.
*
* @param playerCommandLine the complete commandLine which gets splitted into
* it's properties.
*/
private void executePlayerCommand(String playerCommandLine, Object commandParams) {
String[] commandParts = playerCommandLine.split(":");
String playerId = commandParts[0];
String playerCommand = commandParts[1];
MPD daemon = findMPDInstance(playerId);
if (daemon == null) {
// we give that player another chance -> try to reconnect
reconnect(playerId);
}
if (daemon != null) {
PlayerCommandTypeMapping pCommand = null;
try {
pCommand = PlayerCommandTypeMapping.fromString(playerCommand);
MPDPlayer player = daemon.getMPDPlayer();
switch (pCommand) {
case PAUSE: player.pause(); break;
case PLAY: player.play(); break;
case STOP: player.stop(); break;
case VOLUME_INCREASE: player.setVolume(player.getVolume() + VOLUME_CHANGE_SIZE); break;
case VOLUME_DECREASE: player.setVolume(player.getVolume() - VOLUME_CHANGE_SIZE); break;
case NEXT: player.playNext(); break;
case PREV: player.playPrev(); break;
case ENABLE:
case DISABLE:
Integer outputId = Integer.valueOf((String) commandParams);
MPDAdmin admin = daemon.getMPDAdmin();
MPDOutput output = new MPDOutput(outputId - 1); // internally mpd uses 0-based indexing
if (pCommand == PlayerCommandTypeMapping.ENABLE) {
admin.enableOutput(output);
} else {
admin.disableOutput(output);
}
break;
case VOLUME:
logger.debug("Volume adjustment received: '{}' '{}'", pCommand, commandParams);
player.setVolume(((PercentType) commandParams).intValue());
break;
}
}
catch (MPDPlayerException pe) {
logger.error("error while executing {} command: " + pe.getMessage(), pCommand);
}
catch (Exception e) {
logger.warn("unknow playerCommand '{}'", playerCommand);
}
}
else {
logger.warn("didn't find player configuration instance for playerId '{}'", playerId);
}
logger.info("executed commandLine '{}' for player '{}'", playerCommand, playerId);
}