---
title: "initWithMediaItems:mediaContainer:playShuffled:playbackRepeatMode:resumePlayback:playbackQueueLocation:playbackSpeed:mediaSearch:"
framework: intents
role: symbol
role_heading: Instance Method
path: "intents/inplaymediaintent/initwithmediaitems:mediacontainer:playshuffled:playbackrepeatmode:resumeplayback:playbackqueuelocation:playbackspeed:mediasearch:"
---

# initWithMediaItems:mediaContainer:playShuffled:playbackRepeatMode:resumePlayback:playbackQueueLocation:playbackSpeed:mediaSearch:

Initialize an intent that describes media content such as a song, podcast episode, or movie.

## Declaration

```occ
- (instancetype) initWithMediaItems:(NSArray<INMediaItem *> *) mediaItems mediaContainer:(INMediaItem *) mediaContainer playShuffled:(NSNumber *) playShuffled playbackRepeatMode:(INPlaybackRepeatMode) playbackRepeatMode resumePlayback:(NSNumber *) resumePlayback playbackQueueLocation:(INPlaybackQueueLocation) playbackQueueLocation playbackSpeed:(NSNumber *) playbackSpeed mediaSearch:(INMediaSearch *) mediaSearch;
```

## Parameters

- `mediaItems`: The media content, such as a song or episode of TV show, that the user is playing. When donating the intent, the system uses only the first item in the array, ignoring the other media items in the array.
- `mediaContainer`: The container of the media item. For example, when the user plays a song from the playlist, the playlist is the container. A television show with multiple episodes is another example. However, some media items, like movies, may have no container.
- `playShuffled`: A Boolean value that indicates whether the media plays in a shuffled order.
- `playbackRepeatMode`: The repeat mode setting at the time the user plays the media item.
- `resumePlayback`: The resume playback setting at the time the user plays the media item. Set to doc://com.apple.documentation/documentation/Swift/true when the user hasn’t finished listening to or watching the media item.
- `playbackQueueLocation`: The location in the queue to play the media item.
- `playbackSpeed`: The speed to play the media item.
- `mediaSearch`: The search parameters for a media item.

## Discussion

Discussion The INPlayMediaIntent object should include information about the media that accurately represents the content. For example, if the user plays a song from a particular album, include both pieces of information in the intent. Provide the song in mediaItems and the album in mediaContainer. If your app supports options for shuffle play, repeat modes, and resuming playback, include the current settings for those options when creating the intent.

## See Also

### Creating a Play Media Intent

- [initWithMediaItems:mediaContainer:playShuffled:playbackRepeatMode:resumePlayback:](intents/inplaymediaintent/initwithmediaitems:mediacontainer:playshuffled:playbackrepeatmode:resumeplayback:.md)
