本文整理汇总了Java中org.bff.javampd.monitor.MPDStandAloneMonitor.addTrackPositionChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java MPDStandAloneMonitor.addTrackPositionChangeListener方法的具体用法?Java MPDStandAloneMonitor.addTrackPositionChangeListener怎么用?Java MPDStandAloneMonitor.addTrackPositionChangeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bff.javampd.monitor.MPDStandAloneMonitor
的用法示例。
在下文中一共展示了MPDStandAloneMonitor.addTrackPositionChangeListener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: connect
import org.bff.javampd.monitor.MPDStandAloneMonitor; //导入方法依赖的package包/类
/**
* Connects the player <code>playerId</code> to the given <code>host</code>
* and <code>port</code> and registers this binding as MPD-Event listener.
*
* @param playerId
* @param host
* @param port
*/
private void connect(final String playerId) {
MpdPlayerConfig config = null;
try {
config = playerConfigCache.get(playerId);
if (config != null && config.instance == null) {
MPD mpd = new MPD(config.host, config.port, config.password, CONNECTION_TIMEOUT);
MPDStandAloneMonitor mpdStandAloneMonitor = new MPDStandAloneMonitor(mpd, 500);
mpdStandAloneMonitor.addVolumeChangeListener(this);
mpdStandAloneMonitor.addPlayerChangeListener(this);
mpdStandAloneMonitor.addTrackPositionChangeListener(this);
final MpdBinding self = this; // 'this' glue for the inner anon instance
mpdStandAloneMonitor.addOutputChangeListener(new OutputChangeListener() {
@Override
public void outputChanged(OutputChangeEvent e) {
// We have to 'wrap' the OutputChangeEvent listener
// callback and add the playerId so we know which
// player generated the event. There's not enough
// info on just the OutputChangeEvent to derive
// the source player. This 'workaround' is necessary
// to support output control on multiple MPD players.
self.outputChanged(playerId, e);
}
});
Thread monitorThread = new Thread(
mpdStandAloneMonitor, "MPD Monitor (player:" + playerId + ")");
monitorThread.start();
config.instance = mpd;
config.monitor = mpdStandAloneMonitor;
logger.debug("Connected to player '{}' with config {}", playerId, config);
}
}
catch(MPDConnectionException ce) {
logger.error("Error connecting to player '" + playerId + "' with config {}", config, ce);
}
catch (UnknownHostException uhe) {
logger.error("Wrong connection details for player {}", playerId, uhe);
}
}
示例2: connect
import org.bff.javampd.monitor.MPDStandAloneMonitor; //导入方法依赖的package包/类
/**
* Connects the player <code>playerId</code> to the given <code>host</code>
* and <code>port</code> and registers this binding as MPD-Event listener.
*
* @param playerId
* @param host
* @param port
*/
private void connect(final String playerId) {
MpdPlayerConfig config = null;
try {
config = playerConfigCache.get(playerId);
if (config != null && config.instance == null) {
MPD mpd = new MPD(config.host, config.port, config.password, CONNECTION_TIMEOUT);
MPDStandAloneMonitor mpdStandAloneMonitor = new MPDStandAloneMonitor(mpd, 500);
mpdStandAloneMonitor.addVolumeChangeListener(this);
mpdStandAloneMonitor.addPlayerChangeListener(this);
mpdStandAloneMonitor.addTrackPositionChangeListener(this);
final MpdBinding self = this; // 'this' glue for the inner anon instance
mpdStandAloneMonitor.addOutputChangeListener(new OutputChangeListener() {
@Override
public void outputChanged(OutputChangeEvent e) {
// We have to 'wrap' the OutputChangeEvent listener
// callback and add the playerId so we know which
// player generated the event. There's not enough
// info on just the OutputChangeEvent to derive
// the source player. This 'workaround' is necessary
// to support output control on multiple MPD players.
self.outputChanged(playerId, e);
}
});
Thread monitorThread = new Thread(mpdStandAloneMonitor, "MPD Monitor (player:" + playerId + ")");
monitorThread.start();
config.instance = mpd;
config.monitor = mpdStandAloneMonitor;
logger.debug("Connected to player '{}' with config {}", playerId, config);
}
} catch (MPDConnectionException ce) {
logger.error("Error connecting to player '{}' with config {}", playerId, config, ce);
} catch (UnknownHostException uhe) {
logger.error("Wrong connection details for player '{}'", playerId, uhe);
}
}