All Packages Class Hierarchy This Package Previous Next Index
Class ejmf.examples.mediainfo.MediaInfo
java.lang.Object
|
+----ejmf.examples.mediainfo.MediaInfo
- public class MediaInfo
- extends Object
This class is provided as a utility to list attributes of a
particular meduim, and to check whether there is a DataSource
or Player installed that will support it. Upon construction,
the MediaInfo object will attempt to create a MediaLocator from
the given URL, a DataSource from the resulting MediaLocator,
and a Player from the resulting DataSource. References to
these attributes (URL, MediaLocator, DataSource, and Player)
are maintained within the class, along with protocol and
contentType attributes which are defined along the way.
If there is an error in any step in this process of creating a
Player, then the error string is set, and those attributes which
have not yet been set are left as null. Use getError() to get any
error string.
Use of this class is twofold. If run as an application, the
printMediaInfo() method will print all known attributes of the
given medium, as well as any errors that occurred while creating
a player for this medium. Use this method to see if a
protocol is supported and by which DataSource, and if a media
format is supported and by which Player. If there is not a
supported Player for the medium, use the contentType attribute
to form a package structure to hold your new custrom Player.
Use this class also to maintain references to objects created
while creating a Player. Some of these objects may still be
necessary beyond the creation of the Player. Specifically, the
DataSource object which is created en route to a Player is not
accessible via the JMF API once the Player is created. Use of
this class will allow you to reference the DataSource and its
methods.
- See Also:
- URL, MediaLocator, DataSource, Player
-
MediaInfo(MediaLocator)
-
-
MediaInfo(URL)
- Construct a MediaInfo object for the given URL.
-
getContentType()
- Get the content type of this MediaInfo object
-
getDataSource()
- Get the DataSource attribute of this MediaInfo object
-
getError()
- Get the error attribute of this MediaInfo object
-
getMediaLocator()
- Get the MediaLocator attribute of this MediaInfo object
-
getPlayer()
- Get the Player attribute of this MediaInfo object
-
getProtocol()
- Get the protocol of this MediaInfo object
-
getURL()
- Get the URL attribute of this MediaInfo object
-
main(String[])
- For each media URL string, constructs a MediaInfo
object and calls printMediaInfo().
-
printError()
- Prints the formatted error String to System.out
-
printMediaInfo()
- Prints formatted attributes of this MediaInfo object
to System.out
MediaInfo
public MediaInfo(URL url)
- Construct a MediaInfo object for the given URL.
- Parameters:
- url
- the media URL
MediaInfo
public MediaInfo(MediaLocator locator)
getURL
public URL getURL()
- Get the URL attribute of this MediaInfo object
getMediaLocator
public MediaLocator getMediaLocator()
- Get the MediaLocator attribute of this MediaInfo object
getDataSource
public DataSource getDataSource()
- Get the DataSource attribute of this MediaInfo object
getPlayer
public Player getPlayer()
- Get the Player attribute of this MediaInfo object
getProtocol
public String getProtocol()
- Get the protocol of this MediaInfo object
- Returns:
- a String representing the media protocol
getContentType
public String getContentType()
- Get the content type of this MediaInfo object
- Returns:
- a String representing the media content type
getError
public String getError()
- Get the error attribute of this MediaInfo object
- Returns:
- a String description of any error that has occurred
printError
protected void printError()
- Prints the formatted error String to System.out
printMediaInfo
public void printMediaInfo()
- Prints formatted attributes of this MediaInfo object
to System.out
main
public static void main(String args[])
- For each media URL string, constructs a MediaInfo
object and calls printMediaInfo().
- Parameters:
- args
- A list of media URL strings
All Packages Class Hierarchy This Package Previous Next Index