The Media
class represents a media resource. It is instantiated
from the string form of a source URI. Information about the media such as
duration, metadata, tracks, and video resolution may be obtained from a
Media
instance. The media information is obtained asynchronously
and so not necessarily available immediately after instantiation of the class.
All information should however be available if the instance has been
associated with a MediaPlayer
and that player has transitioned to
MediaPlayer.Status.READY
status. To be notified when metadata or
Track
s are added, observers may be registered with the collections
returned by getMetadata()
and getTracks()
, respectively.
The same Media
object may be shared among multiple
MediaPlayer
objects. Such a shared instance might manage a single
copy of the source media data to be used by all players, or it might require a
separate copy of the data for each player. The choice of implementation will
not however have any effect on player behavior at the interface level.
MediaPlayer, MediaException