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

Constructor Index

 o MediaInfo(MediaLocator)
 o MediaInfo(URL)
Construct a MediaInfo object for the given URL.

Method Index

 o getContentType()
Get the content type of this MediaInfo object
 o getDataSource()
Get the DataSource attribute of this MediaInfo object
 o getError()
Get the error attribute of this MediaInfo object
 o getMediaLocator()
Get the MediaLocator attribute of this MediaInfo object
 o getPlayer()
Get the Player attribute of this MediaInfo object
 o getProtocol()
Get the protocol of this MediaInfo object
 o getURL()
Get the URL attribute of this MediaInfo object
 o main(String[])
For each media URL string, constructs a MediaInfo object and calls printMediaInfo().
 o printError()
Prints the formatted error String to System.out
 o printMediaInfo()
Prints formatted attributes of this MediaInfo object to System.out

Constructors

 o MediaInfo
 public MediaInfo(URL url)
Construct a MediaInfo object for the given URL.

Parameters:
url - the media URL
 o MediaInfo
 public MediaInfo(MediaLocator locator)

Methods

 o getURL
 public URL getURL()
Get the URL attribute of this MediaInfo object

 o getMediaLocator
 public MediaLocator getMediaLocator()
Get the MediaLocator attribute of this MediaInfo object

 o getDataSource
 public DataSource getDataSource()
Get the DataSource attribute of this MediaInfo object

 o getPlayer
 public Player getPlayer()
Get the Player attribute of this MediaInfo object

 o getProtocol
 public String getProtocol()
Get the protocol of this MediaInfo object

Returns:
a String representing the media protocol
 o getContentType
 public String getContentType()
Get the content type of this MediaInfo object

Returns:
a String representing the media content type
 o getError
 public String getError()
Get the error attribute of this MediaInfo object

Returns:
a String description of any error that has occurred
 o printError
 protected void printError()
Prints the formatted error String to System.out

 o printMediaInfo
 public void printMediaInfo()
Prints formatted attributes of this MediaInfo object to System.out

 o 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