iTunes.*

Type Library
Revision Release 2024.3703
Keywords iTunes, media, library, song, music
Platforms iOS

Overview

The iTunes plugin enables you to access the user’s iTunes library and play media from it.

Gotchas

You must include the following keys/descriptions in the plist table of build.settings. When the system prompts the user to allow access, the associated description is displayed as part of the alert. Note that these descriptions can be customized to your preference and they can even be localized (guide).

settings =
{
    iphone =
    {
        plist =
        {
            NSAppleMusicUsageDescription = "This app would like to access your music library.",
        },
    },
}

Syntax

local iTunes = require( "plugin.iTunes" )

Functions

iTunes.isPlaying()

iTunes.getVolume()

iTunes.pause()

iTunes.play()

iTunes.resume()

iTunes.setVolume()

iTunes.show()

iTunes.stop()

Project Settings

To use this plugin, add an entry into the plugins table of build.settings. When added, the build server will integrate the plugin during the build phase.

settings =
{
    plugins =
    {
        ["plugin.iTunes"] =
        {
            publisherId = "com.coronalabs"
        },
    },
}

Support