Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

PlaybackInfo

class PlaybackInfo : VersionedParcelable
kotlin.Any
   ↳ androidx.media2.session.MediaController.PlaybackInfo

Holds information about the the way volume is handled for this session.

Summary

Constants

static Int

The session uses local playback.

static Int

The session uses remote playback.

Public methods

Boolean
equals(@Nullable other: Any?)

AudioAttributesCompat?

Get the audio attributes for this session.

Int

Get the type of volume control that can be used.

Int

Get the current volume for this session.

Int

Get the maximum volume that may be set for this session.

Int

Get the type of playback which affects volume handling.

Int

Constants

PLAYBACK_TYPE_LOCAL

static val PLAYBACK_TYPE_LOCAL: Int

The session uses local playback.

Value: 1

PLAYBACK_TYPE_REMOTE

static val PLAYBACK_TYPE_REMOTE: Int

The session uses remote playback.

Value: 2

Public methods

equals

fun equals(@Nullable other: Any?): Boolean

getAudioAttributes

@Nullable fun getAudioAttributes(): AudioAttributesCompat?

Get the audio attributes for this session. The attributes will affect volume handling for the session. When the volume type is PLAYBACK_TYPE_REMOTE these may be ignored by the remote volume handler.

Return
AudioAttributesCompat?: The attributes for this session

getControlType

fun getControlType(): Int

Get the type of volume control that can be used. One of:

Return
Int: The type of volume control that may be used with this session

getCurrentVolume

fun getCurrentVolume(): Int

Get the current volume for this session.

This is only meaningful when the playback type is PLAYBACK_TYPE_REMOTE.

Return
Int: The current volume where this session is playing

getMaxVolume

fun getMaxVolume(): Int

Get the maximum volume that may be set for this session.

This is only meaningful when the playback type is PLAYBACK_TYPE_REMOTE.

Return
Int: The maximum allowed volume where this session is playing

getPlaybackType

fun getPlaybackType(): Int

Get the type of playback which affects volume handling. One of:

Return
Int: The type of playback this session is using

hashCode

fun hashCode(): Int