写一个长按3倍速播放的java代码
时间: 2023-03-14 07:39:51 浏览: 192
public class LongPress3TimesPlayer {
public static void main(String[] args) {
// 创建播放器对象
Player player = new Player();
// 设置播放器的播放速度为3倍速
player.setSpeed(3);
// 长按3次播放
player.play();
player.play();
player.play();
}
}
相关问题
写一个长按3倍速的java代码
public class LongPressThreeTimesSpeed {
public static void main(String[] args) {
// 获取当前系统开始时间
long startTime = System.currentTimeMillis();
while(System.currentTimeMillis() - startTime < 3000){
// 当前系统时间减去开始时间小于3000表示长按3秒
}
// 如果长按3秒,需要执行的操作
System.out.println("3倍速");
}
}
写一个ijkplayer的长按3倍速java代码
public class IjkPlayer {
private long mDuration;
private long mPosition;
private int mSpeed; public IjkPlayer(long duration, long position, int speed) {
this.mDuration = duration;
this.mPosition = position;
this.mSpeed = speed;
}
public void setSpeed(int speed) {
this.mSpeed = speed;
}
public void longPress3Speed() {
mPosition = mPosition + ((mDuration - mPosition) / mSpeed) * 3;
}
}
阅读全文