Type function
Return value none
Revision 2015.2731
Keywords show, iTunes, picker
See also iTunes


Displays the iTunes library picker and enables you to pick one or more items to play back at a future time.

Syntax onComplete ) options, onComplete )
onComplete (required)

Listener. The callback function which is executed after dismissing the iTunes library picker.

options (optional)

Table. Table of parameters for the picker — see the next section for details.

Options Reference

The options table may contain the following properties:

allowsPickingMultipleItems (optional)

Boolean. If set to true, the iTunes picker will allow you to select multiple items to play. Default is false.

promptTitle (optional)

String. The title that appears on the iTunes picker navigation bar. Default is Select song to play.


local iTunes = require( "plugin.iTunes" )

-- Table to store media items
local mediaItems = {}

-- Function that is executed when song playback is complete
local function onPlaybackEnded()
    print( "Playback completed!" )

-- Function that is executed after media item(s) have been chosen
local function onMediaChosen( event )

    if ( ) then
        for i=1, do
            mediaItems[i] =[i]

        --play the first item chosen mediaItems[1].url, onPlaybackEnded )


local iTunesOptions =
    allowsPickingMultipleItems = true,
    promptTitle = "Select some songs"
} iTunesOptions, onMediaChosen )