本文整理汇总了Java中javax.media.Player.Started方法的典型用法代码示例。如果您正苦于以下问题:Java Player.Started方法的具体用法?Java Player.Started怎么用?Java Player.Started使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.media.Player
的用法示例。
在下文中一共展示了Player.Started方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: timeDragged
import javax.media.Player; //导入方法依赖的package包/类
private void timeDragged(int x) {
if (player == null)
return;
// Determine the requested media time based on duration of the file
// and position of the mouse in the control panel.
long dura = player.getDuration().getNanoseconds();
if (dura < 0 || dura > 3 * 3600 * 1000000000L)
return;
long nano = (long) ((float) (x - COMPONENTS[MEDIATIME][0]) /
(COMPONENTS[MEDIATIME][2] -
COMPONENTS[MEDIATIME][0] + 1) * dura);
if (nano < 0) nano = 0;
if (nano > dura) nano = dura;
// Set the media time
player.setMediaTime(new Time(nano));
if (player.getTargetState() < Player.Started)
player.prefetch();
repaint();
}
示例2: rewind
import javax.media.Player; //导入方法依赖的package包/类
private void rewind() {
if (player != null) {
player.setMediaTime(new Time(0));
if (player.getTargetState() < Player.Started)
player.prefetch();
}
}
示例3: actionPerformed
import javax.media.Player; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent ae) {
if (ae.getSource() == comboMovies)
setURL(movies[comboMovies.getSelectedIndex()]);
//setURL((String) comboMovies.getSelectedItem());
if (ae.getSource() == selPanel) {
if (player != null) {
Time newBeginTime =
new Time(selPanel.getStartTimeMillis() * 1000000);
Time newEndTime =
new Time(selPanel.getStopTimeMillis() * 1000000);
if (newBeginTime.getSeconds() != beginTime.getSeconds()) {
if (player.getState() == Player.Started)
player.stop();
player.setMediaTime(newBeginTime);
timerCount = 1000;
beginTime = newBeginTime;
updateLabel();
}
if (newEndTime.getSeconds() != endTime.getSeconds()) {
if (player.getState() == Player.Started)
player.stop();
endTime = newEndTime;
player.setMediaTime(newEndTime);
timerCount = 1000;
updateLabel();
}
}
}
}
示例4: stop
import javax.media.Player; //导入方法依赖的package包/类
@Override
public void stop() {
super.stop();
if(!useAudioBuffer){
try{
if(midi && sequencer!=null){
closeMidiSequencer();
}
else if (player!=null && player.getState()==Player.Started)
player.stop();
} catch(Exception e){
System.err.println("Error stopping media \""+mc.mediaFileName+"\":\n"+e);
}
}
}