FileDocCategorySizeDatePackage
MediaTunnel.javaAPI DocphoneME MR2 API (J2ME)3697Wed May 02 16:47:12 BST 2007com.sun.mmedia

MediaTunnel

public final class MediaTunnel extends Object
Tunnel between media and lcdui This is a singleton object per JVM

Fields Summary
public static final int
PLAYABLE_FROM_BACKGROUND
private static MediaTunnel
instance
private Vector
map
private boolean
hasForeground
Constructors Summary
private MediaTunnel()

    
      
    
Methods Summary
public synchronized voidcallBackgroundEventHandler()
Notify media event consumer about the switch to background

        if (map == null) {
          return;
        }

        int size = map.size();
        hasForeground = false;
        
        for (int i = 0; i < size; ++i) {
            MediaEventConsumer c = (MediaEventConsumer)map.elementAt(i);
            c.handleMediaBackgroundNotify();
        }
    
public synchronized voidcallForegroundEventHandler()
Notify media event consumer about the switch to foreground

        if (map == null) {
            return;
        }

        int size = map.size();
        hasForeground = true;
        
        for (int i = 0; i < size; ++i) {
            MediaEventConsumer c = (MediaEventConsumer)map.elementAt(i);
            c.handleMediaForegroundNotify();
        }
    
public static com.sun.mmedia.MediaTunnelgetInstance()
Get media tunnel singleton object

        if (instance == null) {
            instance =  new MediaTunnel();
        }
        return instance;
    
public booleanisBackPlayable()
Is this midlet background playable?

        return false;
    
public synchronized booleanregisterMediaEventConsumer(MediaEventConsumer consumer)
Register media event consumer

retval
true if the current status is in foreground
retval
false if the current status is in background

        if (map == null) {
            map = new Vector(5);
        }
        
        if (false == map.contains(consumer)) {
            map.addElement(consumer);
        }

        return hasForeground;
    
public synchronized voidunregisterMediaEventConsumer(MediaEventConsumer consumer)
Register media event consumer

retval
true if the current status is in foreground
retval
false if the current status is in background

        if (map == null) {
            return;
        }
        
        if (true == map.contains(consumer)) {
            map.removeElement(consumer);
        }