All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----javax.media.Manager
Manager
is the access point for obtaining
system dependent resources such as Players
,
DataSources
, and the system TimeBase
.
A Player
is an object used to
control and render multimedia data that
is specific to the content type of the data.
A DataSource
is an object used to
deliver time-based multimedia data that is specific
to a delivery protocol.
A DataSource
provides
a Player
with media data;
a Player
must have a DataSource
.
Manager
provides access to a protocol and media independent
mechanism for constructing Players
and
DataSources
.
Manager
will createPlayers
from a
URL
, a MediaLocator
or a DataSource
.
Creating a Player
requires the following:
DataSource
for the specified
protocol
Player
for the content-type
specified by the DataSource
DataSource
to the Player
using the setSource
method.
MediaLocator
defines a protocol for obtaining
content.
DataSources
are identified by the protocol
that they support. Manager
uses the protocol
name to find DataSource
classes.
To find a DataSource
using a MediaLocator
,
Manager
constructs a list of class names from the protocol
package-prefix list and the protocol name obtained
from the MediaLocator
.
For each class name in the constructed list a new DataSource
is instanced, the MediaLocator
is attached,
and the DataSource
is connected.
If no errors have occurred, the procces is considered finished and the
connected DataSource
is used by
Manager
in any following operations.
If there was an error then the next class name in the list
is tried.
The exact details of the search algorithm is described in
the method documentation below.
Player
is a MediaHandler
.
A MediaHandler
is a an object that reads
data from a DataSource
. There are two types
of supported MediaHandler
: MediaProxy
,
and Player
.
MediaHandlers
are identified by the content type that they
support. A DataSource
identifies the content type
of the data it produces with the getContentType
method.
Manager
uses the content type name to
find instances of MediaHandler
.
To find a
If the
If the
If a valid
The detailed creation algorithm is specified in the methods below.
The algorithm for creating a
The algorithm for creating a
Returns a data source for the protocol specified by
the
The algorithm for creating a
The first name in the list will always be:
Each additional name looks like:
The first name in the list will always be:
Each additional name looks like:
MediaHandler
using a content type name,
Manager
constructs a list of class names from
the content package-prefix list and the content type name.
For each class name in the constructed list a new MediaHandler
is instanced, and the DataSource
is attached to
the MediaHandler
using MediaHandler
is a Player
and the
setSource
was successful the process is finished
and the Player
is returned.
If the setSource
failed, another name in the
list is tried.
MediaHandler
is a MediaProxy
then a new DataSource
is obtained from the
MediaProxy
, a new list is created for the
content type the DataSource
supports and the
whole thing is tried again.
Player
, is not found then the whole
procedure is repeated is repeated with "unknown" substituted
for the content-type name. The "unknown" content type is supported
by generic Players
that are capable of handling
a large variety of media types, often in a platform dependent
way.
Player Threads
Players
render media data asynchronously from
the main program flow.
This implies that a Player
must often manage one
or more threads.
The threads managed by the Player
are not
in the thread group of the application that calls
createPlayer
.
System Time Base
All Players
need a TimeBase
. Many
use a system-wide TimeBase
, often based on
a time-of-day clock.
Manager
provides access to the system TimeBase
through getSystemTimeBase
.
createDataSource(MediaLocator)
DataSource
for the specified media.
createDataSource(URL)
DataSource
for the specified media.
createPlayer(DataSource)
Player
for the DataSource
.
createPlayer(MediaLocator)
Player
for the specified media.
createPlayer(URL)
Player
for the specified media.
getDataSourceList(String)
DataSource
class names from the
protocol prefix-list and a protocol name.
getHandlerClassList(String)
Handler/CODE> classes from the
content-prefix-list and a content name.
getSystemTimeBase()
UNKNOWN_CONTENT_NAME
public static final String UNKNOWN_CONTENT_NAME
createPlayer
public static Player createPlayer(URL sourceURL) throws IOException, NoPlayerException
Player
for the specified media.
This creates a MediaLocator from the URL and then
calls createPlayer
.
URL
that describes the media data.
Player
.
Player
can be found.
createPlayer
public static Player createPlayer(MediaLocator sourceLocator) throws IOException, NoPlayerException
Player
for the specified media.
Player
from
a MediaLocator
is:
MediaLocator
.
DataSource
classes that
support the protocol, using the protocol package-prefix-list.
DataSource
,
connect
method to connect the source.
getContentType
)
from the source.
MediaHandler
classes that support the
media-content-type-name, using the content package-prefix-list.
MediaHandler
class in the list:
MediaHandler
.
MediaHandler
by calling
MediaHandler.setSource
.
MediaHandler
; otherwise try the next
MediaHandler
is a Player
,
return the new Player
.
MediaHandler
is a MediaProxy
,
obtain a new DataSource
from the MediaProxy
,
obtain the list of MediaHandlers
that support the new
DataSource
, and continue searching the new list.
MediaHandler
is found for this source,
try the next source in the list.
Player
is found after trying all of the sources,
reuse the source list.
This time, for each source class in the list:
connect
method to connect to the source.
MediaHandler
classes that support the
"unknown" content-type-name.
MediaHandler
class in the list,
search for a Player
as in the previous search.
Player
is found after trying all of the sources,
a NoPlayerException
is thrown.
MediaLocator
that describes
the media content.
Player
for the media described by the source.
Player
can
be found.
createPlayer
public static Player createPlayer(DataSource source) throws IOException, NoPlayerException
Player
for the DataSource
.
Player
from
a DataSource
is:
getContentType
.
Player
classes that support the media content-type name.
Player
class in the list:
Player
.
Player
by calling
setSource
on the Player
.
Player
;
otherwise,
try the next Player
in the list.
Player
is found for this source:
Player
classes that support the
"unknown" content-type-name.
Player
class in the list:
Player
.
Player
by
calling setSource
on the Player
.
Player
;
otherwise, try the next Player
in the list.
Player
can be created,
a NoPlayerException
is thrown.
DataSource
that describes
the media content.
Player
.
Player
can't
be created.
createDataSource
public static DataSource createDataSource(URL sourceURL) throws IOException, NoDataSourceException
DataSource
for the specified media.
URL
that describes the media data.
DataSource
for the media.
DataSource
can be found.
createDataSource
public static DataSource createDataSource(MediaLocator sourceLocator) throws IOException, NoDataSourceException
DataSource
for the specified media.
MediaLocator
. The returned data source
is connected; DataSource.connect
has been
invoked.
DataSource
from
a MediaLocator
is:
MediaLocator
.
DataSource
classes that
support the protocol.
DataSource
.
connect
to connect the source.
URL
from the
MediaLocator
and use it to create
a URLDataSource
NoDataSourceException
is thrown.
DataSource
.
DataSource
can be found.
getSystemTimeBase
public static TimeBase getSystemTimeBase()
getDataSourceList
public static Vector getDataSourceList(String protocolName)
DataSource
class names from the
protocol prefix-list and a protocol name.
media.protocol.<protocol>DataSource
for every
<protocol-prefix>.media.protocol.<protocol>.DataSource
<protocol-prefix>
in the
protocol-prefix-list.
Player
class-name.
getHandlerClassList
public static Vector getHandlerClassList(String contentName)
Handler/CODE> classes from the
content-prefix-list and a content name.
media.content.<contentType>.Handler
for every
<content-prefix>.media.content.<contentName>.Player
<content-prefix>
in the
content-prefix-list.
Player
class-name.
All Packages Class Hierarchy This Package Previous Next Index