📄 clock.html
字号:
A <code>Clock</code> returns to the <i>Stopped</i> state immediately when the <code>stop</code> method is called or the <i>media time</i> passes the stop time. <p> Certain methods can only be invoked when the <code>Clock</code> is in a particular state. If the <code>Clock</code> is in the wrong state when one of these methods is called, an error or exception is thrown. <h3>Methods Restricted to <i>Started</i> Clocks</h3> The <code>mapToTimeBase</code> method can only be called on a <code>Clock</code> in the <i>Started</i> state. If it is invoked on a <i>Stopped</i> <code>Clock</code>, a <code>ClockStoppedException</code> is thrown. This is because the <code>Clock</code> is not synchronized to a <code>TimeBase</code> when it is <i>Stopped</i>. <h3>Methods Restricted to <i>Stopped</i> Clocks</h3> The following methods can only be called on a <code>Clock</code> in the <i>Stopped</i> state. If invoked on a <i>Started</i> <code>Clock</code>, these methods throw a <code>ClockStartedError</code>. <ul> <li> <code>syncStart</code> <li> <code>setTimeBase</code> <li> <code>setMediaTime</code> <li> <code>setRate</code> </ul> Resetting the rate, the <i>media time</i>, the time base, or the <i>time-base start-time</i> implies a complete remapping between the <code>Clock</code> and its <code>TimeBase</code> and is not allowed on a <i>Started</i> <code>Clock</code>. <h3>Methods with Additional Restrictions</h3> A race condition occurs if a new <i>media stop-time</i> is set when a <code>Clock</code> is already approaching a previously set <i>media stop-time</i>. In this situation, it impossible to guarantee when the <code>Clock</code> will stop. To prevent this race condition, <code>setStopTime</code> can only be set once on a <i>Started</i> <code>Clock</code>. A <code>StopTimeSetError</code> is thrown if <code>setStopTime</code> is called and the <i>media stop-time</i> has already been set. <p> There are no restrictions on calling <code>setStopTime</code> on a <i>Stopped</i> <code>Clock</code>; the stop time can always be reset if the <code>Clock</code> is <i>Stopped</i>.<P><DL><DT><B>See Also: </B><DD><A HREF="../../javax/media/TimeBase.html"><CODE>TimeBase</CODE></A>, <A HREF="../../javax/media/Player.html"><CODE>Player</CODE></A></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../javax/media/Time.html">Time</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/media/Clock.html#RESET">RESET</A></B></CODE><BR> Returned by <CODE>getStopTime</CODE> if the stop-time is unset.</TD></TR></TABLE> <!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> long</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/media/Clock.html#getMediaNanoseconds()">getMediaNanoseconds</A></B>()</CODE><BR> Gets this <code>Clock's</code> current <i>media time</i> in nanoseconds.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/media/Time.html">Time</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/media/Clock.html#getMediaTime()">getMediaTime</A></B>()</CODE><BR> Gets this <code>Clock's</code> current <i>media time</i>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> float</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/media/Clock.html#getRate()">getRate</A></B>()</CODE><BR> Gets the current temporal scale factor.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/media/Time.html">Time</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/media/Clock.html#getStopTime()">getStopTime</A></B>()</CODE><BR> Gets the last value successfully set by <CODE>setStopTime</CODE>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/media/Time.html">Time</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/media/Clock.html#getSyncTime()">getSyncTime</A></B>()</CODE><BR> Gets the current <i>media time</i> or the time until this <code>Clock</code> will synchronize to its <code>TimeBase</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/media/TimeBase.html">TimeBase</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/media/Clock.html#getTimeBase()">getTimeBase</A></B>()</CODE><BR> Gets the <code>TimeBase</code> that this <code>Clock</code> is using.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../javax/media/Time.html">Time</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/media/Clock.html#mapToTimeBase(javax.media.Time)">mapToTimeBase</A></B>(<A HREF="../../javax/media/Time.html">Time</A> t)</CODE><BR> Gets the <code>TimeBase</code> time corresponding to the specified <i>media time</i>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/media/Clock.html#setMediaTime(javax.media.Time)">setMediaTime</A></B>(<A HREF="../../javax/media/Time.html">Time</A> now)</CODE><BR> Sets the <code>Clock's</code> <i>media time</i>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> float</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/media/Clock.html#setRate(float)">setRate</A></B>(float factor)</CODE><BR> Sets the temporal scale factor.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/media/Clock.html#setStopTime(javax.media.Time)">setStopTime</A></B>(<A HREF="../../javax/media/Time.html">Time</A> stopTime)</CODE><BR> Sets the <i>media time</i> at which you want the <code>Clock</code> to stop.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/media/Clock.html#setTimeBase(javax.media.TimeBase)">setTimeBase</A></B>(<A HREF="../../javax/media/TimeBase.html">TimeBase</A> master)</CODE><BR> Sets the <code>TimeBase</code> for this <code>Clock</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/media/Clock.html#stop()">stop</A></B>()</CODE><BR> Stops the <code>Clock</code>.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/media/Clock.html#syncStart(javax.media.Time)">syncStart</A></B>(<A HREF="../../javax/media/Time.html">Time</A> at)</CODE><BR> Synchronizes the current <i>media time</i> to the specified <I>time-base time</I> and start the <code>Clock</code>.</TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><A NAME="field_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Field Detail</B></FONT></TD></TR></TABLE><A NAME="RESET"><!-- --></A><H3>RESET</H3><PRE>public static final <A HREF="../../javax/media/Time.html">Time</A> <B>RESET</B></PRE><DL><DD>Returned by <CODE>getStopTime</CODE> if the stop-time is unset.</DL><!-- ========= CONSTRUCTOR DETAIL ======== --><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="setTimeBase(javax.media.TimeBase)"><!-- --></A><H3>setTimeBase</H3><PRE>public void <B>setTimeBase</B>(<A HREF="../../javax/media/TimeBase.html">TimeBase</A> master) throws <A HREF="../../javax/media/IncompatibleTimeBaseException.html">IncompatibleTimeBaseException</A></PRE><DL><DD>Sets the <code>TimeBase</code> for this <code>Clock</code>. This method can only be called on a <i>Stopped</i> <code>Clock</code>. A <code>ClockStartedError</code> is thrown if <code>setTimeBase</code> is called on a <i>Started</i> <code>Clock</code>. <p> A <code>Clock</code> has a default <code>TimeBase</code> that is determined by the implementation. To reset a <code>Clock</code> to its default <code>TimeBase</code>, call <code>setTimeBase(null)</code>.<DD><DL><DT><B>Parameters:</B><DD><CODE>master</CODE> - The new <CODE>TimeBase</CODE> or <CODE>null</CODE> to reset the <code>Clock</code> to its default <code>TimeBase</code>.<DT><B>Throws:</B><DD><A HREF="../../javax/media/IncompatibleTimeBaseException.html">IncompatibleTimeBaseException</A> - Thrown if the <code>Clock</code> can't use the specified <code>TimeBase</code>.</DL></DD></DL>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -