本文整理汇总了Java中javax.media.EndOfMediaEvent类的典型用法代码示例。如果您正苦于以下问题:Java EndOfMediaEvent类的具体用法?Java EndOfMediaEvent怎么用?Java EndOfMediaEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EndOfMediaEvent类属于javax.media包,在下文中一共展示了EndOfMediaEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: controllerUpdate
import javax.media.EndOfMediaEvent; //导入依赖的package包/类
/**
* This controllerUpdate function must be defined in order to
* implement a ControllerListener interface. This
* function will be called whenever there is a media event.
*
* @param event
* the media event
*/
public synchronized void controllerUpdate(ControllerEvent event) {
if( event instanceof RealizeCompleteEvent ) {
Runnable r = new Runnable() {
public void run() {
// Add Control Panel Component
playerpanel.addControlComponent();
// Add Visual Component
playerpanel.addVisualComponent();
}
};
SwingUtilities.invokeLater(r);
} else
if (event instanceof EndOfMediaEvent) {
// End of the media -- rewind
player.setMediaTime(new Time(0));
}
}
示例2: controllerUpdate
import javax.media.EndOfMediaEvent; //导入依赖的package包/类
public synchronized void controllerUpdate(ControllerEvent ce) {
if (ce instanceof RealizeCompleteEvent) {
realized = true;
} else if (ce instanceof ConfigureCompleteEvent) {
configured = true;
} else if (ce instanceof PrefetchCompleteEvent) {
prefetched = true;
} else if (ce instanceof EndOfMediaEvent) {
//System.out.println("EndOfMediaEvent: " + ce);
eom = true;
} else if (ce instanceof ControllerErrorEvent) {
System.err.println("ControllerErrorEvent: " + ce);
failed = true;
} else if (ce instanceof ControllerClosedEvent) {
//System.out.println("ControllerClosedEvent: " + ce);
closed = true;
} else {
return;
}
notifyAll();
}
示例3: controllerUpdate
import javax.media.EndOfMediaEvent; //导入依赖的package包/类
/**
* Controller Listener.
*/
public void controllerUpdate(ControllerEvent evt) {
if (evt instanceof ConfigureCompleteEvent ||
evt instanceof RealizeCompleteEvent ||
evt instanceof PrefetchCompleteEvent) {
synchronized (waitSync) {
stateTransitionOK = true;
waitSync.notifyAll();
}
} else if (evt instanceof ResourceUnavailableEvent) {
synchronized (waitSync) {
stateTransitionOK = false;
waitSync.notifyAll();
}
} else if (evt instanceof EndOfMediaEvent) {
p.setMediaTime(new Time(0));
//p.start();
//p.close();
//System.exit(0);
} else if (evt instanceof SizeChangeEvent) {
}
}
示例4: controllerUpdate
import javax.media.EndOfMediaEvent; //导入依赖的package包/类
/**
* Controller Listener.
*/
public void controllerUpdate(ControllerEvent evt) {
if (evt instanceof ConfigureCompleteEvent ||
evt instanceof RealizeCompleteEvent ||
evt instanceof PrefetchCompleteEvent) {
synchronized (waitSync) {
stateTransitionOK = true;
waitSync.notifyAll();
}
} else if (evt instanceof ResourceUnavailableEvent) {
synchronized (waitSync) {
stateTransitionOK = false;
waitSync.notifyAll();
}
} else if (evt instanceof EndOfMediaEvent) {
evt.getSourceController().stop();
evt.getSourceController().close();
}
}
示例5: controllerUpdate
import javax.media.EndOfMediaEvent; //导入依赖的package包/类
/**
* Controller Listener.
*/
public void controllerUpdate(ControllerEvent evt) {
if (evt instanceof ConfigureCompleteEvent ||
evt instanceof RealizeCompleteEvent ||
evt instanceof PrefetchCompleteEvent) {
synchronized (waitSync) {
stateTransitionOK = true;
waitSync.notifyAll();
}
} else if (evt instanceof ResourceUnavailableEvent) {
synchronized (waitSync) {
stateTransitionOK = false;
waitSync.notifyAll();
}
} else if (evt instanceof EndOfMediaEvent) {
p.close();
System.exit(0);
}
}
示例6: controllerUpdate
import javax.media.EndOfMediaEvent; //导入依赖的package包/类
/**
* Controller Listener.
*/
public void controllerUpdate(ControllerEvent evt) {
if (evt instanceof ConfigureCompleteEvent ||
evt instanceof RealizeCompleteEvent ||
evt instanceof PrefetchCompleteEvent) {
synchronized (waitSync) {
stateTransitionOK = true;
waitSync.notifyAll();
}
} else if (evt instanceof ResourceUnavailableEvent) {
synchronized (waitSync) {
stateTransitionOK = false;
waitSync.notifyAll();
}
} else if (evt instanceof EndOfMediaEvent) {
p.close();
//System.exit(0);
} else if (evt instanceof SizeChangeEvent) {
}
}
示例7: controllerUpdate
import javax.media.EndOfMediaEvent; //导入依赖的package包/类
/**
* Controller Listener.
*/
public void controllerUpdate(ControllerEvent evt) {
if (evt instanceof ConfigureCompleteEvent ||
evt instanceof RealizeCompleteEvent ||
evt instanceof PrefetchCompleteEvent) {
synchronized (waitSync) {
stateTransitionOK = true;
waitSync.notifyAll();
}
} else if (evt instanceof ResourceUnavailableEvent) {
synchronized (waitSync) {
stateTransitionOK = false;
waitSync.notifyAll();
}
} else if (evt instanceof EndOfMediaEvent) {
p.close();
} else if (evt instanceof SizeChangeEvent) {
}
}
示例8: controllerUpdate
import javax.media.EndOfMediaEvent; //导入依赖的package包/类
/**
* Controller Listener.
*/
public void controllerUpdate(ControllerEvent evt) {
if (evt instanceof ConfigureCompleteEvent
|| evt instanceof RealizeCompleteEvent
|| evt instanceof PrefetchCompleteEvent) {
synchronized (waitSync) {
stateTransitionOK = true;
waitSync.notifyAll();
}
} else if (evt instanceof ResourceUnavailableEvent) {
synchronized (waitSync) {
stateTransitionOK = false;
waitSync.notifyAll();
}
} else if (evt instanceof EndOfMediaEvent) {
processor.setMediaTime(Processor.RESET);
processor.start();
//processor.close();
//System.exit(0);
}
}
示例9: controllerUpdate
import javax.media.EndOfMediaEvent; //导入依赖的package包/类
public void controllerUpdate(ControllerEvent evt) {
if (evt instanceof ConfigureCompleteEvent
|| evt instanceof RealizeCompleteEvent
|| evt instanceof PrefetchCompleteEvent) {
synchronized (waitSync) {
stateTransitionOK = true;
waitSync.notifyAll();
}
} else if (evt instanceof ResourceUnavailableEvent) {
synchronized (waitSync) {
stateTransitionOK = false;
waitSync.notifyAll();
}
} else if (evt instanceof EndOfMediaEvent) {
evt.getSourceController().stop();
evt.getSourceController().close();
finished = true;
}
}
示例10: createPlayer
import javax.media.EndOfMediaEvent; //导入依赖的package包/类
private static synchronized Player createPlayer(String mediaUri) {
try {
URL url = replaceJarUrlWithFileUrl(ResourceManager.getResource(mediaUri), mediaUri);
MediaLocator locator = new MediaLocator(url);
final Player mediaPlayer = Manager.createRealizedPlayer(locator);
// add a listener to put us in an infinite loop
mediaPlayer.addControllerListener(new ControllerListener() {
public void controllerUpdate(ControllerEvent evt) {
if(evt instanceof EndOfMediaEvent) {
mediaPlayer.setMediaTime(new Time(0));
mediaPlayer.start();
}
}
});
return mediaPlayer;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
示例11: controllerUpdate
import javax.media.EndOfMediaEvent; //导入依赖的package包/类
public void controllerUpdate(ControllerEvent evt) {
if (evt instanceof EndOfMediaEvent) {
if (diaMessage.getExpectedDigits() == 0) {
handleDTMF("0");
} else {
resetDelay = true;
while (resetDelay) {
try {
resetDelay = false;
Thread.sleep(5000);
} catch (InterruptedException e) {
BrokerFactory.getLoggingBroker().logError(e);
}
}
transmitter.stop();
transmitter.playSound("file://"+diaMessage.getWaveFilename());
}
}
}
示例12: controllerUpdate
import javax.media.EndOfMediaEvent; //导入依赖的package包/类
/**
* This controllerUpdate function must be defined in order to
* implement a ControllerListener interface. This
* function will be called whenever there is a media event.
*
* @param event
* the ControllerEvent
*/
public void controllerUpdate(final ControllerEvent event) {
final Controller source = event.getSourceController();
final boolean isSlave = slaves.contains(source);
if( event instanceof TransitionEvent ||
event instanceof ControllerErrorEvent )
{
Runnable r = new Runnable() {
public void run() {
if(isSlave) {
int index = slaves.indexOf(source);
writeEvent("[slave" + index + "] " + event.toString());
} else {
setState();
writeEvent("[master] " + event.toString());
}
}
};
SwingUtilities.invokeLater(r);
}
// Return if this is a slave
if(isSlave) return;
if(event instanceof EndOfMediaEvent) {
// End of the media -- rewind
player.setMediaTime(new Time(0));
}
}
示例13: controllerUpdate
import javax.media.EndOfMediaEvent; //导入依赖的package包/类
public synchronized void controllerUpdate(ControllerEvent event) {
// If we're getting messages from a dead player, just leave
if (player == null) return;
if (event instanceof EndOfMediaEvent) {
player.setMediaTime(new Time(0));
}
}
示例14: controllerUpdate
import javax.media.EndOfMediaEvent; //导入依赖的package包/类
/**
* This controllerUpdate function must be defined in order to
* implement a ControllerListener interface. This
* function will be called whenever there is a media event
*/
public synchronized void controllerUpdate(ControllerEvent event) {
/*
* Set the state of the buttons to the correct values.
*/
if (event instanceof EndOfMediaEvent) {
// End of the media -- rewind
player.setMediaTime(new Time(0));
}
}
示例15: controllerUpdate
import javax.media.EndOfMediaEvent; //导入依赖的package包/类
/**
* This controllerUpdate function must be defined in order to
* implement a ControllerListener interface. This
* function will be called whenever there is a media event
*/
public /*synchronized */ void controllerUpdate(ControllerEvent event) {
// If we're getting messages from a dead player, just leave
if (player == null) return;
if (event instanceof EndOfMediaEvent) {
// End of the media -- rewind
player.setMediaTime(new Time(0));
}
}