Type function Return value Number Revision Release 2024.3703 Keywords getVolume, iTunes See also iTunes iTunes.setVolume()
Retrieves the playback volume of an item that was selected from the iTunes library.
iTunes.getVolume()
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!" ) end -- Function that is executed after media item(s) have been chosen local function onMediaChosen( event ) if ( event.data ) then for i=1,#event.data do mediaItems[i] = event.data[i] end --play the first item chosen iTunes.play( mediaItems[1].url, onPlaybackEnded ) --set the playback volume iTunes.setVolume( 0.5 ) --print the playback volume iTunes.getVolume() end end local iTunesOptions = { allowsPickingMultipleItems = true, promptTitle = "Select some songs" } iTunes.show( iTunesOptions, onMediaChosen )