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
.
Creating Players and DataSources
Manager
will create
Players
from a
URL
, a
MediaLocator
or a
DataSource
.
Creating a
Player
requires the following:
- Obtain the connected
DataSource
for the specified
protocol
- Obtain the
Player
for the content-type
specified by the DataSource
- Attach the
DataSource
to the Player
using the setSource
method.
It is possible to create multiple Players for the same scarce resource
(such as a hardware video decoder).
However, doing so may affect the state of other Players which depend on
that resource.
Finding DataSources by Protocol
A
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.
Finding Players by Content Type
A
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 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.setSource.
If the 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.
If the 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.
If a valid 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.
The detailed creation algorithm is specified in the methods below.
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
.