|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
Media Applet Synchronization Interface (MASI)
MASI can be used to synchronize several media Applets
located in one document to make them cooperate and deliver the
same multimedia content.
An example of this would be to combine a whiteboard Applet with an
audio streaming Applet to deliver some lecture over the world wide web.
The underlying concept of this Interface is the notion of a frame.
All methods that address offsets use frames as their basic unit. A frame is a
certain amount of time. Frames are atomic in the sense that there are no fractions of frames.
Every Applet has to provide methods to convert the abstract unit frame into concrete amounts of time.
The amounts of time should be chosen as small as possible to allow fine granular control of the streams.
Technically speaking an Applet must implement this Interface and use
AppletContext.getApplets() to get all other Applets in the
document. Then one should check every returned object whether it is
instanceof masi.MASI. Sometimes however, the Enumeration returned by
getApplets() returns elements containing null. Therefore it is wise, not only to
check for null elemnts, but also to repeat the getApplets() call in this case.
The next step is to verify the version, which can safely be obtained by reading MASIVERSION.
One problem is, that there is no proper way to find out what kind
of media each Applet is delivering.
In order to solve this, Applets can get each other's instances by
the AppletContext.getApplet(String name) method.
We suggest using the following names for the different types of media Applets:
| Name | Type |
|---|---|
| audio | An audio streaming Applet |
| video | A video streaming Applet |
| whiteboard | A whiteboard Applet |
| board | Another name for a whiteboard Applet |
| presentation | A slide show Applet |
| chat | A chat line |
| console | An Applet providing a GUI to MASI features |
getName()
in order to find the one which delivers the audio portion of your content.
synchronized.
| Field Summary | |
static int |
CANBACKWARDOFFSET
If you want to call backwardOffset(), getCapabilities() & CANBACKWARDOFFSET must be true. |
static int |
CANCLOSE
If you want to call close(), getCapabilities() & CANCLOSE must be true. |
static int |
CANFORWARDOFFSET
If you want to call forwardOffset(), getCapabilities() & CANFORWARDOFFSET must be true. |
static int |
CANGETCHAPTEROFFSET
If you want to call getChapterOffset(), getCapabilities() & CANGETCHAPTEROFFFSET must be true. |
static int |
CANGETCURCHAPTER
If you want to call getCurChapter(), getCapabilities() & CANGETCURCHAPTER must be true. |
static int |
CANGETTOC
If you want to call getTOC(), getCapabilities() & CANGETTOC must be true. |
static int |
CANGETTOTALFRAMES
If you want to call getTotalFrames(), getCapabilities() & CANGETTOTALFRAMES must be true. |
static int |
CANPAUSE
If you want to call pause(), getCapabilities() & CANPAUSE must be true. |
static int |
CANREDOFROMSTART
If you want to call redoFromStart(), getCapabilities() & CANREDOFROMSTART must be true. |
static int |
CANSETOFFSET
If you want to call setOffset(), getCapabilities() & CANSETOFFSET must be true. |
static int |
MASIVERSION
Contains the version of this interface multiplied by 100. |
| Method Summary | |
long |
backwardOffset(long frames)
Fast-backwards some frames. |
boolean |
close()
Requests to close the whole Applet. |
java.lang.Object |
exchangeData(java.lang.Object o)
This method can be used if two Applets want to exchange data in some way not specified by MASI. |
long |
forwardOffset(long frames)
Fast-forwards some frames. |
java.util.Date |
getAbsoluteBeginningTime()
Gets the absolute time when isInitFinished() could return true for the first time. |
int |
getCapabilities()
Returns the capabilities of the Applet as integer. |
long |
getChapterOffset(int i)
Returns the offset (in frames) where chapter number i starts. |
java.lang.String |
getCopyrightInformation()
Returns copyright|left information. |
int |
getCurChapter()
Returns the current chapter. |
double |
getFrameDurationMillis()
Gets the length of one frame in milliseconds. |
long |
getFramesPerMilli()
Provides the conversion between frames and milliseconds. |
java.lang.String |
getName()
Gets the name of the Applet. |
long |
getOffset()
Gets the current offset in frames. |
java.lang.String[] |
getTOC()
Gets table of contents if available. |
long |
getTotalFrames()
Gets the total length of this stream. |
int |
getVersion()
Gets the version of Applet. |
boolean |
hasPermanentErrors()
Returns true if the Applet has permanent errors. |
boolean |
isDestroyed()
Is true when the Applet has been destroyed. |
boolean |
isFinished()
Is true when an Applet has finished playing because the end of the stream has been reached. |
boolean |
isInitFinished()
Returns true when the Applet has finished initialization and is working. |
boolean |
isPaused()
Returns true if the Applet is paused. |
boolean |
isStalled()
Returns true if the Applet has a bad connection to the Internet or some other problems at this moment. |
boolean |
isStopped()
Is true when an Applet is in the stopped state. |
boolean |
pause(boolean onoff)
Pauses or continues playing the stream. |
boolean |
redoFromStart()
Reinitializes the Applet. |
long |
setOffset(long frame)
Sets the current player position to frame. |
| Field Detail |
public static final int MASIVERSION
public static final int CANBACKWARDOFFSET
backwardOffset(), getCapabilities() & CANBACKWARDOFFSET must be true.
backwardOffset(long)public static final int CANFORWARDOFFSET
forwardOffset(), getCapabilities() & CANFORWARDOFFSET must be true.
forwardOffset(long)public static final int CANSETOFFSET
setOffset(), getCapabilities() & CANSETOFFSET must be true.
setOffset(long)public static final int CANPAUSE
pause(), getCapabilities() & CANPAUSE must be true.
pause(boolean)public static final int CANREDOFROMSTART
redoFromStart(), getCapabilities() & CANREDOFROMSTART must be true.
redoFromStart()public static final int CANCLOSE
close(), getCapabilities() & CANCLOSE must be true.
close()public static final int CANGETTOC
getTOC(), getCapabilities() & CANGETTOC must be true.
getTOC()public static final int CANGETCHAPTEROFFSET
getChapterOffset(), getCapabilities() & CANGETCHAPTEROFFFSET must be true.
getChapterOffset(int)public static final int CANGETCURCHAPTER
getCurChapter(), getCapabilities() & CANGETCURCHAPTER must be true.
getCurChapter()public static final int CANGETTOTALFRAMES
getTotalFrames(), getCapabilities() & CANGETTOTALFRAMES must be true.
getTotalFrames()| Method Detail |
public int getCapabilities()
| Bit | Method | Constant |
|---|---|---|
| 1 | backwardOffset() | CANBACKWARDOFFSET |
| 2 | forwardOffset() | CANFORWARDOFFSET |
| 3 | setOffset() | CANSETOFFSET |
| 4 | pause() | CANPAUSE |
| 5 | redoFromStart() | CANREDOFROMSTART |
| 6 | close() | CANCLOSE |
| 7 | getTOC() | CANGETTOC |
| 8 | getChapterOffset() | CANGETCHAPTEROFFSET |
| 9 | getCurChapter() | CANGETCURCHAPTER |
| 10 | getTotalFrames() | CANGETTOTALFRAMES |
| 11..32 | reserved for future use | |
backwardOffset(long),
forwardOffset(long),
setOffset(long),
pause(boolean),
redoFromStart(),
close(),
getTOC(),
getChapterOffset(int),
getCurChapter(),
getTotalFrames()public boolean isInitFinished()
init() method.
public boolean isStalled()
public boolean hasPermanentErrors()
public boolean isPaused()
pause(true) to get into this state.
public boolean isFinished()
public boolean isStopped()
stop() method
has been called or before the start() method is invoked.
In an Applet that cannot be restarted isStopped() has the same
semantic as the negation of Applet.isActive(). After being set to true once, the return value can switch back
to false only if the Applet is restartable.
isDestroyed()public boolean isDestroyed()
destroy() method
has been called. Once an Applet is destroyed, it cannot be restarted. Therefore this value cannot switch from true to false.
A return value of true also implies that the Applet is in the stopped state and therefore isStopped() also
returns true.
isStopped()public java.util.Date getAbsoluteBeginningTime()
isInitFinished() could return true for the first time.
java.util.Date object.isInitFinished()public long getOffset()
public long getFramesPerMilli()
getFrameDurationMillis().
Applets that want to indicate that a more precise number is required, should return 0 here.
getFrameDurationMillis()public double getFrameDurationMillis()
getFramesPerMilli(). This method can be used when a more precise number
is required or it is better to calculate with milliseconds per frame instead of frames per milliseconds.
getFramesPerMilli()public java.lang.String getName()
getVersion(),
getCopyrightInformation()public int getVersion()
getName(),
getCopyrightInformation()public java.lang.String getCopyrightInformation()
getName(),
getVersion()public long getTotalFrames()
public java.lang.String[] getTOC()
CANGETTOCpublic long getChapterOffset(int i)
getChapterOffset(0)=0. If i exceeds the amount of chapters in the document
getChapterOffset(i) returns 0, too. 0 is also returned for negative values of i.
i - the chapter numberCANGETCHAPTEROFFSETpublic int getCurChapter()
CANGETCURCHAPTERpublic long setOffset(long frame)
forwardOffset() and
backwardOffset() to skip frames, because they can be implemented more efficiently sometimes.
frame - the new offset in the streamCANSETOFFSET,
forwardOffset(long),
backwardOffset(long)public long forwardOffset(long frames)
backwardoffset() should be used instead of setOffset().
frames - a positive value indicating how many frames should be skipped from the current position of the stream.CANFORWARDOFFSET,
backwardOffset(long),
setOffset(long)public long backwardOffset(long frames)
forwardoffset() should be used instead of setOffset().
frames - a positive value indicating how many frames should skipped backwards from the current position of the stream.CANBACKWARDOFFSET,
forwardOffset(long),
setOffset(long)public boolean redoFromStart()
CANREDOFROMSTARTpublic boolean pause(boolean onoff)
isPaused() will return true or false accordingly.
Please notice, that pausing a stream may be a better method for synchronizing
than setOffset(), because usually it can be implemented more efficiently.
true - for pause, false for continueCANPAUSE,
CANSETOFFSET,
isPaused(),
setOffset(long)public java.lang.Object exchangeData(java.lang.Object o)
o - an Objectpublic boolean close()
destroy() method, the Applet has the choice to deny or accept the request. An
Applet may or may not support this method properly, please check getCapabilities().
getCapabilities(),
CANCLOSE,
isDestroyed(),
isStopped()
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||