FileDocCategorySizeDatePackage
MediaSessionCompatApi18.javaAPI DocAndroid 5.1 API3009Thu Mar 12 22:22:56 GMT 2015android.support.v4.media.session

MediaSessionCompatApi18

public class MediaSessionCompatApi18 extends Object

Fields Summary
Constructors Summary
Methods Summary
public static java.lang.ObjectcreatePlaybackPositionUpdateListener(MediaSessionCompatApi14.Callback callback)

        return new OnPlaybackPositionUpdateListener<MediaSessionCompatApi14.Callback>(callback);
    
public static voidregisterMediaButtonEventReceiver(android.content.Context context, android.app.PendingIntent pi)

        AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
        am.registerMediaButtonEventReceiver(pi);
    
public static voidsetOnPlaybackPositionUpdateListener(java.lang.Object rccObj, java.lang.Object onPositionUpdateObj)

        ((RemoteControlClient) rccObj).setPlaybackPositionUpdateListener(
                (RemoteControlClient.OnPlaybackPositionUpdateListener) onPositionUpdateObj);
    
public static voidsetState(java.lang.Object rccObj, int state, long position, float speed, long updateTime)

        long currTime = SystemClock.elapsedRealtime();
        if (state == MediaSessionCompatApi14.STATE_PLAYING && position > 0) {
            long diff = 0;
            if (updateTime > 0) {
                diff = currTime - updateTime;
                if (speed > 0 && speed != 1f) {
                    diff *= speed;
                }
            }
            position += diff;
        }
        state = MediaSessionCompatApi14.getRccStateFromState(state);
        ((RemoteControlClient) rccObj).setPlaybackState(state, position, speed);
    
public static voidunregisterMediaButtonEventReceiver(android.content.Context context, android.app.PendingIntent pi)

        AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
        am.unregisterMediaButtonEventReceiver(pi);