public class NativeMediaManager
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
NativeMediaManager.NativeMediaManagerInitializer
The NativeMediaManager singleton.
|
private static class |
NativeMediaManager.NativeMediaPlayerDisposer |
Modifier and Type | Field and Description |
---|---|
private static java.util.Map<MediaPlayer,java.lang.Boolean> |
allMediaPlayers
List of all un-disposed players.
|
private java.util.List<java.lang.ref.WeakReference<MediaErrorListener>> |
errorListeners
The
MediaErrorListener s. |
private static boolean |
isNativeLayerInitialized
Whether the native layer has been initialized.
|
private static NativeMediaManager.NativeMediaPlayerDisposer |
playerDisposer |
private java.util.List<java.lang.String> |
supportedContentTypes |
private java.util.List<java.lang.String> |
supportedProtocols |
Modifier | Constructor and Description |
---|---|
protected |
NativeMediaManager()
Create a
NativeMediaManager . |
Modifier and Type | Method and Description |
---|---|
void |
addMediaErrorListener(MediaErrorListener listener) |
boolean |
canPlayContentType(java.lang.String contentType)
Whether a media source having the indicated content type may be played.
|
boolean |
canPlayProtocol(java.lang.String protocol)
Whether a media source having the indicated protocol may be played.
|
java.util.List<MediaPlayer> |
getAllMediaPlayers()
Retrieve all un-disposed
MediaPlayer s. |
static NativeMediaManager |
getDefaultInstance()
Get the default
NativeMediaManager . |
Media |
getMedia(Locator locator)
Get a player for the media locator.
|
(package private) java.util.List<java.lang.ref.WeakReference<MediaErrorListener>> |
getMediaErrorListeners() |
static MetadataParser |
getMetadataParser(Locator locator) |
MediaPlayer |
getPlayer(Locator locator) |
java.lang.String[] |
getSupportedContentTypes() |
(package private) static void |
initNativeLayer()
Initialize the native layer if it has not been so already.
|
private void |
loadContentTypes() |
private void |
loadProtocols() |
static void |
registerMediaPlayerForDispose(java.lang.Object obj,
MediaPlayer player)
This function will register MediaPlayer for disposing when obj parameter
does not have any strong reference.
|
void |
removeMediaErrorListener(MediaErrorListener listener) |
private static boolean isNativeLayerInitialized
private final java.util.List<java.lang.ref.WeakReference<MediaErrorListener>> errorListeners
MediaErrorListener
s.private static final NativeMediaManager.NativeMediaPlayerDisposer playerDisposer
private static final java.util.Map<MediaPlayer,java.lang.Boolean> allMediaPlayers
private final java.util.List<java.lang.String> supportedContentTypes
private final java.util.List<java.lang.String> supportedProtocols
public static NativeMediaManager getDefaultInstance()
NativeMediaManager
.NativeMediaManager
instance.static void initNativeLayer()
private void loadContentTypes()
private void loadProtocols()
public boolean canPlayContentType(java.lang.String contentType)
java.lang.IllegalArgumentException
- if
contentType
is
null
.MediaManager.canPlayContentType(java.lang.String)
public java.lang.String[] getSupportedContentTypes()
public boolean canPlayProtocol(java.lang.String protocol)
java.lang.IllegalArgumentException
- if
protocol
is
null
.MediaManager.canPlayProtocol(java.lang.String)
public static MetadataParser getMetadataParser(Locator locator)
public MediaPlayer getPlayer(Locator locator)
MediaManager#getPlayer(com.sun.media.jfxmedia.locator.Locator, int)
public Media getMedia(Locator locator)
locator
- permitFullScan
- public void addMediaErrorListener(MediaErrorListener listener)
public void removeMediaErrorListener(MediaErrorListener listener)
public static void registerMediaPlayerForDispose(java.lang.Object obj, MediaPlayer player)
obj
- - Object to watch for strong referencesplayer
- - MediaPlayer to disposepublic java.util.List<MediaPlayer> getAllMediaPlayers()
MediaPlayer
s.List
of all un-disposed players or
null
.java.util.List<java.lang.ref.WeakReference<MediaErrorListener>> getMediaErrorListeners()