# Action.SetMediaItems

# Action.SetMediaItems

Artifact:[androidx.media3:media3-test-utils](https://developer.android.com/jetpack/androidx/releases/media3)  
[View Source](https://cs.android.com/search?q=file:androidx/media3/test/utils/Action.java+class:androidx.media3.test.utils.Action.SetMediaItems)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/media3/test/utils/Action.SetMediaItems "View this page in Java")

<br />

```
class Action.SetMediaItems : Action
```

<br />

|---|---|---------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)                                                                      |||
| ↳ | [androidx.media3.test.utils.Action](https://developer.android.com/reference/kotlin/androidx/media3/test/utils/Action)                                ||
|   | ↳ | [androidx.media3.test.utils.Action.SetMediaItems](https://developer.android.com/reference/kotlin/androidx/media3/test/utils/Action.SetMediaItems) |

*** ** * ** ***

Calls[setMediaSources](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/ExoPlayer#setMediaSources(java.util.List<androidx.media3.exoplayer.source.MediaSource>,int,long)).

## Summary

|                                                                                                                                                                                                                                                                                                                                                      ### Public constructors                                                                                                                                                                                                                                                                                                                                                       |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [SetMediaItems](https://developer.android.com/reference/kotlin/androidx/media3/test/utils/Action.SetMediaItems#SetMediaItems(java.lang.String,int,long,androidx.media3.exoplayer.source.MediaSource...))`(` ` tag: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!,` ` mediaItemIndex: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` positionMs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`,` ` mediaSources: `[Array](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html)`<`[MediaSource](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource)`!>!` `)` |

|                            ### Protected functions                            |
|-------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [doActionImpl](https://developer.android.com/reference/kotlin/androidx/media3/test/utils/Action.SetMediaItems#doActionImpl(androidx.media3.exoplayer.ExoPlayer,androidx.media3.exoplayer.trackselection.DefaultTrackSelector,android.view.Surface))`(` ` player: `[ExoPlayer](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/ExoPlayer)`!,` ` trackSelector: `[DefaultTrackSelector](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/DefaultTrackSelector)`!,` ` surface: `[Surface](https://developer.android.com/reference/android/view/Surface.html)`?` `)` Called by[doActionAndScheduleNextImpl](https://developer.android.com/reference/kotlin/androidx/media3/test/utils/Action#doActionAndScheduleNextImpl(androidx.media3.exoplayer.ExoPlayer,androidx.media3.exoplayer.trackselection.DefaultTrackSelector,android.view.Surface,androidx.media3.common.util.HandlerWrapper,androidx.media3.test.utils.ActionSchedule.ActionNode))to perform the action. |

## Public constructors

### SetMediaItems

```
SetMediaItems(
    tag: String!,
    mediaItemIndex: Int,
    positionMs: Long,
    mediaSources: Array<MediaSource!>!
)
```  

|                                                                                                    Parameters                                                                                                     |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------|
| `tag: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!`                                                                                                                       | A tag to use for logging.                            |
| `mediaItemIndex: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                                                     | The media item index to start playback from.         |
| `positionMs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)                                                                                                                       | The position in milliseconds to start playback from. |
| `mediaSources: `[Array](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html)`<`[MediaSource](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource)`!>!` | The media sources to populate the playlist with.     |

## Protected functions

### doActionImpl

```
protected fun doActionImpl(
    player: ExoPlayer!,
    trackSelector: DefaultTrackSelector!,
    surface: Surface?
): Unit
```

Called by[doActionAndScheduleNextImpl](https://developer.android.com/reference/kotlin/androidx/media3/test/utils/Action#doActionAndScheduleNextImpl(androidx.media3.exoplayer.ExoPlayer,androidx.media3.exoplayer.trackselection.DefaultTrackSelector,android.view.Surface,androidx.media3.common.util.HandlerWrapper,androidx.media3.test.utils.ActionSchedule.ActionNode))to perform the action.  

|                                                                        Parameters                                                                        |
|----------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------|
| `player: `[ExoPlayer](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/ExoPlayer)`!`                                             | The player to which the action should be applied.                          |
| `trackSelector: `[DefaultTrackSelector](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/DefaultTrackSelector)`!` | The track selector to which the action should be applied.                  |
| `surface: `[Surface](https://developer.android.com/reference/android/view/Surface.html)`?`                                                               | The surface to use when applying actions, or`null`if no surface is needed. |