# CloudMediaProvider.CloudMediaSurfaceStateChangedCallback

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in [R Extensions 3](https://developer.android.com/sdkExtensions)

# CloudMediaSurfaceStateChangedCallback

*** ** * ** ***

Kotlin \|[Java](https://developer.android.com/reference/android/provider/CloudMediaProvider.CloudMediaSurfaceStateChangedCallback "View this page in Java")  

```
class CloudMediaSurfaceStateChangedCallback
```

|---|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                                                                         ||
| ↳ | [android.provider.CloudMediaProvider.CloudMediaSurfaceStateChangedCallback](https://developer.android.com/reference/kotlin/android/provider/CloudMediaProvider.CloudMediaSurfaceStateChangedCallback#) |

This class is used by [CloudMediaProvider](https://developer.android.com/reference/kotlin/android/provider/CloudMediaProvider) to send [Surface](https://developer.android.com/reference/kotlin/android/view/Surface.html#) state updates to picker launched via [MediaStore.ACTION_PICK_IMAGES](https://developer.android.com/reference/kotlin/android/provider/MediaStore#ACTION_PICK_IMAGES:kotlin.String).

## Summary

|                                                                                                                                                                                    Constants                                                                                                                                                                                    ||
|-----------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [PLAYBACK_STATE_BUFFERING](https://developer.android.com/reference/kotlin/android/provider/CloudMediaProvider.CloudMediaSurfaceStateChangedCallback#PLAYBACK_STATE_BUFFERING:kotlin.Int) Constant to notify that the playback is buffering                                                   |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [PLAYBACK_STATE_COMPLETED](https://developer.android.com/reference/kotlin/android/provider/CloudMediaProvider.CloudMediaSurfaceStateChangedCallback#PLAYBACK_STATE_COMPLETED:kotlin.Int) Constant to notify that the playback has completed                                                  |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [PLAYBACK_STATE_ERROR_PERMANENT_FAILURE](https://developer.android.com/reference/kotlin/android/provider/CloudMediaProvider.CloudMediaSurfaceStateChangedCallback#PLAYBACK_STATE_ERROR_PERMANENT_FAILURE:kotlin.Int) Constant to notify that the playback has failed with a permanent error. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [PLAYBACK_STATE_ERROR_RETRIABLE_FAILURE](https://developer.android.com/reference/kotlin/android/provider/CloudMediaProvider.CloudMediaSurfaceStateChangedCallback#PLAYBACK_STATE_ERROR_RETRIABLE_FAILURE:kotlin.Int) Constant to notify that the playback has failed with a retriable error. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [PLAYBACK_STATE_MEDIA_SIZE_CHANGED](https://developer.android.com/reference/kotlin/android/provider/CloudMediaProvider.CloudMediaSurfaceStateChangedCallback#PLAYBACK_STATE_MEDIA_SIZE_CHANGED:kotlin.Int) Constant to notify that the media size is first known or has changed.             |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [PLAYBACK_STATE_PAUSED](https://developer.android.com/reference/kotlin/android/provider/CloudMediaProvider.CloudMediaSurfaceStateChangedCallback#PLAYBACK_STATE_PAUSED:kotlin.Int) Constant to notify that the playback is paused.                                                           |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [PLAYBACK_STATE_READY](https://developer.android.com/reference/kotlin/android/provider/CloudMediaProvider.CloudMediaSurfaceStateChangedCallback#PLAYBACK_STATE_READY:kotlin.Int) Constant to notify that the playback is ready to be played                                                  |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [PLAYBACK_STATE_STARTED](https://developer.android.com/reference/kotlin/android/provider/CloudMediaProvider.CloudMediaSurfaceStateChangedCallback#PLAYBACK_STATE_STARTED:kotlin.Int) Constant to notify that the playback has started                                                        |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                   Public methods                                                                                                                                                                                                                                                                                                                                                                                                                                                    ||
|------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [setPlaybackState](https://developer.android.com/reference/kotlin/android/provider/CloudMediaProvider.CloudMediaSurfaceStateChangedCallback#setPlaybackState(kotlin.Int,%20kotlin.Int,%20android.os.Bundle))`(`surfaceId:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `playbackState:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `playbackStateInfo:` `[Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)?`)` This is called to notify playback state update for a [Surface](https://developer.android.com/reference/kotlin/android/view/Surface.html#) on the picker launched via [MediaStore.ACTION_PICK_IMAGES](https://developer.android.com/reference/kotlin/android/provider/MediaStore#ACTION_PICK_IMAGES:kotlin.String). |

## Constants

### PLAYBACK_STATE_BUFFERING

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in [R Extensions 3](https://developer.android.com/sdkExtensions)  

```
static val PLAYBACK_STATE_BUFFERING: Int
```

Constant to notify that the playback is buffering  

    Value: 1

### PLAYBACK_STATE_COMPLETED

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in [R Extensions 3](https://developer.android.com/sdkExtensions)  

```
static val PLAYBACK_STATE_COMPLETED: Int
```

Constant to notify that the playback has completed  

    Value: 5

### PLAYBACK_STATE_ERROR_PERMANENT_FAILURE

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in [R Extensions 3](https://developer.android.com/sdkExtensions)  

```
static val PLAYBACK_STATE_ERROR_PERMANENT_FAILURE: Int
```

Constant to notify that the playback has failed with a permanent error.  

    Value: 7

### PLAYBACK_STATE_ERROR_RETRIABLE_FAILURE

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in [R Extensions 3](https://developer.android.com/sdkExtensions)  

```
static val PLAYBACK_STATE_ERROR_RETRIABLE_FAILURE: Int
```

Constant to notify that the playback has failed with a retriable error.  

    Value: 6

### PLAYBACK_STATE_MEDIA_SIZE_CHANGED

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in [R Extensions 3](https://developer.android.com/sdkExtensions)  

```
static val PLAYBACK_STATE_MEDIA_SIZE_CHANGED: Int
```

Constant to notify that the media size is first known or has changed. Pass the width and height of the media as a [Point](https://developer.android.com/reference/kotlin/android/graphics/Point.html#) inside the [Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#) with [ContentResolver.EXTRA_SIZE](https://developer.android.com/reference/kotlin/android/content/ContentResolver.html#EXTRA_SIZE:kotlin.String) as the key.  

    Value: 8

**See Also**

- [android.provider.CloudMediaProvider.CloudMediaSurfaceStateChangedCallback#setPlaybackState(int, int, Bundle)](https://developer.android.com/reference/kotlin/android/provider/CloudMediaProvider.CloudMediaSurfaceStateChangedCallback#setPlaybackState(kotlin.Int,%20kotlin.Int,%20android.os.Bundle))
- [android.media.MediaPlayer.OnVideoSizeChangedListener#onVideoSizeChanged(MediaPlayer, int, int)](https://developer.android.com/reference/kotlin/android/media/MediaPlayer.OnVideoSizeChangedListener.html#onVideoSizeChanged(android.media.MediaPlayer,%20kotlin.Int,%20kotlin.Int))  

### PLAYBACK_STATE_PAUSED

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in [R Extensions 3](https://developer.android.com/sdkExtensions)  

```
static val PLAYBACK_STATE_PAUSED: Int
```

Constant to notify that the playback is paused.  

    Value: 4

### PLAYBACK_STATE_READY

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in [R Extensions 3](https://developer.android.com/sdkExtensions)  

```
static val PLAYBACK_STATE_READY: Int
```

Constant to notify that the playback is ready to be played  

    Value: 2

### PLAYBACK_STATE_STARTED

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in [R Extensions 3](https://developer.android.com/sdkExtensions)  

```
static val PLAYBACK_STATE_STARTED: Int
```

Constant to notify that the playback has started  

    Value: 3

## Public methods

### setPlaybackState

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in [R Extensions 3](https://developer.android.com/sdkExtensions)  

```
fun setPlaybackState(
    surfaceId: Int, 
    playbackState: Int, 
    playbackStateInfo: Bundle?
): Unit
```

This is called to notify playback state update for a [Surface](https://developer.android.com/reference/kotlin/android/view/Surface.html#) on the picker launched via [MediaStore.ACTION_PICK_IMAGES](https://developer.android.com/reference/kotlin/android/provider/MediaStore#ACTION_PICK_IMAGES:kotlin.String).

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ||
|---------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `surfaceId`         | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): id which uniquely identifies a [Surface](https://developer.android.com/reference/kotlin/android/view/Surface.html#)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `playbackState`     | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): playback state to notify picker about Value is either `0` or a combination of [android.provider.CloudMediaProvider.CloudMediaSurfaceStateChangedCallback#PLAYBACK_STATE_BUFFERING](https://developer.android.com/reference/kotlin/android/provider/CloudMediaProvider.CloudMediaSurfaceStateChangedCallback#PLAYBACK_STATE_BUFFERING:kotlin.Int), [android.provider.CloudMediaProvider.CloudMediaSurfaceStateChangedCallback#PLAYBACK_STATE_READY](https://developer.android.com/reference/kotlin/android/provider/CloudMediaProvider.CloudMediaSurfaceStateChangedCallback#PLAYBACK_STATE_READY:kotlin.Int), [android.provider.CloudMediaProvider.CloudMediaSurfaceStateChangedCallback#PLAYBACK_STATE_STARTED](https://developer.android.com/reference/kotlin/android/provider/CloudMediaProvider.CloudMediaSurfaceStateChangedCallback#PLAYBACK_STATE_STARTED:kotlin.Int), [android.provider.CloudMediaProvider.CloudMediaSurfaceStateChangedCallback#PLAYBACK_STATE_PAUSED](https://developer.android.com/reference/kotlin/android/provider/CloudMediaProvider.CloudMediaSurfaceStateChangedCallback#PLAYBACK_STATE_PAUSED:kotlin.Int), [android.provider.CloudMediaProvider.CloudMediaSurfaceStateChangedCallback#PLAYBACK_STATE_COMPLETED](https://developer.android.com/reference/kotlin/android/provider/CloudMediaProvider.CloudMediaSurfaceStateChangedCallback#PLAYBACK_STATE_COMPLETED:kotlin.Int), [android.provider.CloudMediaProvider.CloudMediaSurfaceStateChangedCallback#PLAYBACK_STATE_ERROR_RETRIABLE_FAILURE](https://developer.android.com/reference/kotlin/android/provider/CloudMediaProvider.CloudMediaSurfaceStateChangedCallback#PLAYBACK_STATE_ERROR_RETRIABLE_FAILURE:kotlin.Int), [android.provider.CloudMediaProvider.CloudMediaSurfaceStateChangedCallback#PLAYBACK_STATE_ERROR_PERMANENT_FAILURE](https://developer.android.com/reference/kotlin/android/provider/CloudMediaProvider.CloudMediaSurfaceStateChangedCallback#PLAYBACK_STATE_ERROR_PERMANENT_FAILURE:kotlin.Int), and [android.provider.CloudMediaProvider.CloudMediaSurfaceStateChangedCallback#PLAYBACK_STATE_MEDIA_SIZE_CHANGED](https://developer.android.com/reference/kotlin/android/provider/CloudMediaProvider.CloudMediaSurfaceStateChangedCallback#PLAYBACK_STATE_MEDIA_SIZE_CHANGED:kotlin.Int) |
| `playbackStateInfo` | [Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)?: [Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#) which may contain extra information about the playback state, such as media size, progress/seek info or details about errors. This value may be `null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |