Esempio n. 1
0
 @Override
 public synchronized void move(final boolean direction, final long time) {
   if (!_future.isDone()) {
     final Parameters params = _group.getParameters(null);
     final int oldValue = (Integer) params.get(Player.JUMP_TIME);
     params.put(Player.JUMP_TIME, time);
     _group.setParameters(params);
     try {
       if (direction) {
         _group.triggerAction(Player.JUMP_FORWARD);
       } else {
         _group.triggerAction(Player.JUMP_BACKWARD);
       }
     } finally {
       params.put(Player.JUMP_TIME, oldValue);
       _group.setParameters(params);
     }
   }
 }
Esempio n. 2
0
 @Override
 public synchronized void jump(final int index) {
   if (!_future.isDone()) {
     final Parameters params = _group.getParameters(null);
     final int oldValue = (Integer) params.get(Player.JUMP_PLAYLIST_INCREMENT);
     try {
       if (index > 0) {
         params.put(Player.JUMP_PLAYLIST_INCREMENT, index);
         _group.setParameters(params);
         _group.triggerAction(Player.JUMP_FORWARD_IN_PLAYLIST);
       } else if (index < 0) {
         params.put(Player.JUMP_PLAYLIST_INCREMENT, -index);
         _group.setParameters(params);
         _group.triggerAction(Player.JUMP_BACKWARD_IN_PLAYLIST);
       }
     } finally {
       params.put(Player.JUMP_PLAYLIST_INCREMENT, oldValue);
       _group.setParameters(params);
     }
   }
 }
Esempio n. 3
0
 @Override
 public void stop() {
   if (!_future.isDone()) {
     _group.triggerAction(Player.STOP);
     try {
       _future.get();
     } catch (InterruptedException e) {
       // ignore
     } catch (ExecutionException e) {
       // ignore
     }
   }
 }
Esempio n. 4
0
  @Override
  public void speed(final boolean upOrDown) {
    lock.lock();
    try {
      if (!_future.isDone()) {
        if (upOrDown) {
          _group.triggerAction(Player.SPEED_UP);
        } else {
          _group.triggerAction(Player.SPEED_DOWN);
        }

        while (!speedResult && !_future.isDone()) {
          try {
            speedActionResult.await(5, TimeUnit.SECONDS);
          } catch (InterruptedException e) {
            // ignore
          }
        }
        speedResult = false;
      }
    } finally {
      lock.unlock();
    }
  }
Esempio n. 5
0
  @Override
  public void resume() {
    lock.lock();
    try {
      if (!_future.isDone() && paused) {
        _group.triggerAction(Recorder.RESUME);

        while (!resumeResult && !_future.isDone()) {
          try {
            resumeActionResult.await(5, TimeUnit.SECONDS);
          } catch (InterruptedException e) {
            // ignore
          }
        }

        resumeResult = false;
      }
    } finally {
      lock.unlock();
    }
  }
Esempio n. 6
0
  @Override
  public void pause() {
    lock.lock();
    try {
      if (!_future.isDone() && !paused) {
        _group.triggerAction(Player.PAUSE);

        while (!pauseResult && !_future.isDone()) {
          try {
            pauseActionResult.await(5, TimeUnit.SECONDS);
          } catch (InterruptedException e) {
            // ignore
          }
        }

        pauseResult = false;
      }
    } finally {
      lock.unlock();
    }
  }