# MediaController.PlaybackInfo

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# PlaybackInfo

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/media/session/MediaController.PlaybackInfo "View this page in Java")  

```
class PlaybackInfo : Parcelable
```

|---|----------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                           ||
| ↳ | [android.media.session.MediaController.PlaybackInfo](https://developer.android.com/reference/kotlin/android/media/session/MediaController.PlaybackInfo#) |

Holds information about the current playback and how audio is handled for this session.

## Summary

|                                                                                                                                   Constants                                                                                                                                   ||
|----------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [PLAYBACK_TYPE_LOCAL](https://developer.android.com/reference/kotlin/android/media/session/MediaController.PlaybackInfo#PLAYBACK_TYPE_LOCAL:kotlin.Int) The session uses local playback.    |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [PLAYBACK_TYPE_REMOTE](https://developer.android.com/reference/kotlin/android/media/session/MediaController.PlaybackInfo#PLAYBACK_TYPE_REMOTE:kotlin.Int) The session uses remote playback. |

| Inherited constants ||
|---|---|
| From class[Parcelable](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#) |----------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [CONTENTS_FILE_DESCRIPTOR](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR:kotlin.Int) <br /> Descriptor bit used with[describeContents()](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#describeContents()): indicates that the Parcelable object's flattened representation includes a file descriptor. <br />                                                                                                                                                                                                        | | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int) <br /> Flag for use with[writeToParcel](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#writeToParcel(android.os.Parcel,%20kotlin.Int)): the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`". Some implementations may want to release resources at this point. <br /> | ||

|                                                                                                                                                                                                                                   Public methods                                                                                                                                                                                                                                    ||
|--------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                             | [describeContents](https://developer.android.com/reference/kotlin/android/media/session/MediaController.PlaybackInfo#describeContents())`()` <br />                                                                                                                                                                                                                         |
| [AudioAttributes](https://developer.android.com/reference/kotlin/android/media/AudioAttributes.html#)! | [getAudioAttributes](https://developer.android.com/reference/kotlin/android/media/session/MediaController.PlaybackInfo#getAudioAttributes())`()` Get the audio attributes for this session.                                                                                                                                                                                 |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                             | [getCurrentVolume](https://developer.android.com/reference/kotlin/android/media/session/MediaController.PlaybackInfo#getCurrentVolume())`()` Get the current volume for this session.                                                                                                                                                                                       |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                             | [getMaxVolume](https://developer.android.com/reference/kotlin/android/media/session/MediaController.PlaybackInfo#getMaxVolume())`()` Get the maximum volume that may be set for this session.                                                                                                                                                                               |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                             | [getPlaybackType](https://developer.android.com/reference/kotlin/android/media/session/MediaController.PlaybackInfo#getPlaybackType())`()` Get the type of playback which affects volume handling.                                                                                                                                                                          |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                             | [getVolumeControl](https://developer.android.com/reference/kotlin/android/media/session/MediaController.PlaybackInfo#getVolumeControl())`()` Get the volume control type associated to the session, as indicated by[android.media.VolumeProvider#getVolumeControl()](https://developer.android.com/reference/kotlin/android/media/VolumeProvider.html#getVolumeControl()).  |
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?                      | [getVolumeControlId](https://developer.android.com/reference/kotlin/android/media/session/MediaController.PlaybackInfo#getVolumeControlId())`()` Get the routing controller ID for this session, as indicated by[android.media.VolumeProvider#getVolumeControlId()](https://developer.android.com/reference/kotlin/android/media/VolumeProvider.html#getVolumeControlId()). |
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)                       | [toString](https://developer.android.com/reference/kotlin/android/media/session/MediaController.PlaybackInfo#toString())`()` <br />                                                                                                                                                                                                                                         |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                           | [writeToParcel](https://developer.android.com/reference/kotlin/android/media/session/MediaController.PlaybackInfo#writeToParcel(android.os.Parcel,%20kotlin.Int))`(`dest:` `[Parcel](https://developer.android.com/reference/kotlin/android/os/Parcel.html#)`, `flags:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` <br />               |

|                                                                                                                                                                                                    Properties                                                                                                                                                                                                    ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|
| static[Parcelable.Creator](https://developer.android.com/reference/kotlin/android/os/Parcelable.Creator.html#)\<[MediaController.PlaybackInfo](https://developer.android.com/reference/kotlin/android/media/session/MediaController.PlaybackInfo#)!\> | [CREATOR](https://developer.android.com/reference/kotlin/android/media/session/MediaController.PlaybackInfo#CREATOR:android.os.Parcelable.Creator) <br /> |

## Constants

### PLAYBACK_TYPE_LOCAL

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val PLAYBACK_TYPE_LOCAL: Int
```

The session uses local playback.  

    Value: 1

### PLAYBACK_TYPE_REMOTE

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val PLAYBACK_TYPE_REMOTE: Int
```

The session uses remote playback.  

    Value: 2

## Public methods

### describeContents

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun describeContents(): Int
```

|                                                                                                                                                                               Return                                                                                                                                                                               ||
|----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either`0`or[android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR:kotlin.Int) |

### getAudioAttributes

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getAudioAttributes(): AudioAttributes!
```

Get the audio attributes for this session. The attributes will affect volume handling for the session. When the playback type is[PlaybackInfo.PLAYBACK_TYPE_REMOTE](https://developer.android.com/reference/kotlin/android/media/session/MediaController.PlaybackInfo#PLAYBACK_TYPE_REMOTE:kotlin.Int)these may be ignored by the remote volume handler.

|                                                                  Return                                                                  ||
|--------------------------------------------------------------------------------------------------------|----------------------------------|
| [AudioAttributes](https://developer.android.com/reference/kotlin/android/media/AudioAttributes.html#)! | The attributes for this session. |

### getCurrentVolume

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getCurrentVolume(): Int
```

Get the current volume for this session.

|                                                            Return                                                             ||
|----------------------------------------------------------------------------|---------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | The current volume where this session is playing. |

### getMaxVolume

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getMaxVolume(): Int
```

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

|                                                                Return                                                                 ||
|----------------------------------------------------------------------------|-----------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | The maximum allowed volume where this session is playing. |

### getPlaybackType

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getPlaybackType(): Int
```

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

- [PLAYBACK_TYPE_LOCAL](https://developer.android.com/reference/kotlin/android/media/session/MediaController.PlaybackInfo#PLAYBACK_TYPE_LOCAL:kotlin.Int)
- [PLAYBACK_TYPE_REMOTE](https://developer.android.com/reference/kotlin/android/media/session/MediaController.PlaybackInfo#PLAYBACK_TYPE_REMOTE:kotlin.Int)

<br />

|                                                         Return                                                          ||
|----------------------------------------------------------------------------|---------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | The type of playback this session is using. |

### getVolumeControl

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getVolumeControl(): Int
```

Get the volume control type associated to the session, as indicated by[android.media.VolumeProvider#getVolumeControl()](https://developer.android.com/reference/kotlin/android/media/VolumeProvider.html#getVolumeControl()).  

### getVolumeControlId

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getVolumeControlId(): String?
```

Get the routing controller ID for this session, as indicated by[android.media.VolumeProvider#getVolumeControlId()](https://developer.android.com/reference/kotlin/android/media/VolumeProvider.html#getVolumeControlId()). Returns null if unset, or if[getPlaybackType()](https://developer.android.com/reference/kotlin/android/media/session/MediaController.PlaybackInfo#getPlaybackType())is[PLAYBACK_TYPE_LOCAL](https://developer.android.com/reference/kotlin/android/media/session/MediaController.PlaybackInfo#PLAYBACK_TYPE_LOCAL:kotlin.Int).  

### toString

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun toString(): String
```

|                                                          Return                                                          ||
|----------------------------------------------------------------------------------|----------------------------------------|
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | a string representation of the object. |

### writeToParcel

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun writeToParcel(
    dest: Parcel, 
    flags: Int
): Unit
```

|                                                                                                                                                                                                                                                                                     Parameters                                                                                                                                                                                                                                                                                     ||
|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `dest`  | [Parcel](https://developer.android.com/reference/kotlin/android/os/Parcel.html#):The Parcel in which the object should be written. This value cannot be`null`.                                                                                                                                                                                                                                                                                                                                                                                                            |
| `flags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Additional flags about how the object should be written. May be 0 or[PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int). Value is either`0`or a combination of[android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int), and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |

## Properties

### CREATOR

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val CREATOR: Parcelable.Creator<MediaController.PlaybackInfo!>
```