Package javax.media

Examples of javax.media.Time


  }

  //@Override
  public Time getPlayerStartLatency()
  {
    return new Time(0);
  }
View Full Code Here


            SwingUtilities.invokeLater(r);
        } else

        if (event instanceof EndOfMediaEvent) {
            // End of the media -- rewind
            player.setMediaTime(new Time(0));
        }
    }
View Full Code Here

        }

  public void controllerUpdate(ControllerEvent event) {
      Player player = (Player) event.getSourceController();
      if (event instanceof EndOfMediaEvent) {
            player.setMediaTime(new Time(0));
            }
      else if (event instanceof RealizeCompleteEvent) {
    SwingUtilities.invokeLater(new AddComponentsThread(player));
      }
  }
View Full Code Here

     */
    public AbstractPlayer() {
        super();

        controllers = new Vector();
        duration = new Time(0);
    }
View Full Code Here

     * Controllers that this Player may be managing.  If any of
     * the Controllers returns DURATION_UNKNOWN or
     * DURATION_UNBOUNDED, then the duration is set to this value.
     */
    private synchronized final void updateDuration() {
        Time duration = getPlayerDuration();

        if( duration != DURATION_UNKNOWN )
        {
            for(int i = 0, n = controllers.size(); i < n; i++) {
                Controller c =
                    (Controller)controllers.elementAt(i);

                Time d = c.getDuration();

                if( d == DURATION_UNKNOWN ) {
                    duration = d;
                    break;
                }

                if( duration != DURATION_UNBOUNDED &&
                    ( d == DURATION_UNBOUNDED ||
                      d.getNanoseconds() >
                      duration.getNanoseconds() ) )
                {
                    duration = d;
                }
            }
View Full Code Here

        {
            throw new NotRealizedError(
                "Cannot get start latency from an Unrealized Controller");
        }

        Time latency = getPlayerStartLatency();

        for(int i = 0, n = controllers.size(); i < n; i++) {
            Controller c = (Controller)controllers.elementAt(i);
            Time l = c.getStartLatency();

            if( l == LATENCY_UNKNOWN ) {
                continue;
            }

            if( latency == LATENCY_UNKNOWN ||
                l.getNanoseconds() > latency.getNanoseconds() )
            {
                latency = l;
            }
        }
View Full Code Here

  }
  connected = true;
    }

    public Time getDuration() {
  return new Time(totalDuration);
    }
View Full Code Here

    }

    // Seek back to zero
    private void rewind() {
  if (player != null) {
      player.setMediaTime(new Time(0));
      if (player.getTargetState() < Player.Started)
    player.prefetch();
  }
    }
View Full Code Here

          (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();
    }
View Full Code Here

            SwingUtilities.invokeLater(r);
        } else

        if (event instanceof EndOfMediaEvent) {
            // End of the media -- rewind
            player.setMediaTime(new Time(0));
        }
    }
View Full Code Here

TOP

Related Classes of javax.media.Time

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.