iTunes Driver

Modified on 2010/12/15 14:23 by Administrator — Categorized as: Driver

Image

The iTunes driver controls and reacts to events from the Apple iTunes Media Player. iTunes and the Desktop Server must be installed on the computer that the driver runs on.

This driver requires that the Desktop Server application be running on the pc running iTunes for this driver to work. This is because iTunes runs on the windows desktop within a user session.

iTunes only supports 1 audio zone. The System Media Player is the recommended alternate media player.

Manufacturer: Apple

Table of Contents [Hide/Show]


Configuration Settings
Events
   Zone Current Track Artist Changed
   Zone Current Track Album Changed
   Zone Current Track Title Changed
   Zone Current Track Genr Changed
   Zone Volume Changed
   Zone Mute State Changed
   Zone Mode Changed
   Zone Shuffle State Changed
   Zone Repeat Mode Changed
   Zone Playlist Position Changed
   Zone Playlist Length Changed
   Zone Playlist Name Changed
   Zone Playlist URL Changed
   Ready State Changed
   Playing
   Paused
   Track Changed
Instance Properties
   ZoneNames
   ZoneCurrentTrackArtists
   ZoneCurrentTrackAlbums
   ZoneCurrentTrackTitles
   ZoneCurrentTrackGenres
   ZoneVolumes
   ZoneMuteStates
   ZoneTransportModes
   Connected
   ZoneCount
   ZoneCurrentTrackDurations
   ZoneCurrentTrackPositions
   ZoneCurrentTrackPaths
   ZoneShuffleStates
   ZoneRepeatModes
   ZonePlaylistPositions
   ZonePlaylistLengths
   ZonePlaylistNames
   ZonePlaylistUrls
   ZoneCurrentTrackCoverArts
   DeviceDisplayName
   DeviceStartTime
   DeviceLifecycleStage
   DeviceIsRunningAndReady
Instance Methods
   PlayZone ( Number )
   StopZone ( Number )
   PauseZone ( Number )
   ToggleZonePause ( Number )
   PlayNextZoneTrack ( Number )
   PlayPreviousZoneTrack ( Number )
   PlayZoneItem ( Number, String )
   PlayZoneItems ( Number, Array )
   ClearZonePlaylist ( Number )
   SetZoneVolume ( Number, Number )
   OffsetZoneVolume ( Number, Number )
   MuteZone ( Number )
   UnmuteZone ( Number )
   SetZoneTransportMode ( Number, String )
   SetZoneCurrentTrackPosition ( Number, TimeSpan )
   SetPropertyForDuration ( String, TimeSpan, Object, Object )
   SetPropertyForDuration ( String, Number, TimeSpan, Object, Object )


Configuration Settings


Events

Zone Current Track Artist Changed

Occurs when the current track's artist changes.

Whenever Filter:


EventArgs:


Zone Current Track Album Changed

Occurs when the current track's album changes.

Whenever Filter:


EventArgs:


Zone Current Track Title Changed

Occurs when the current track's title changes.

Whenever Filter:


EventArgs:


Zone Current Track Genr Changed

Occurs when the current track's genre changes.

Whenever Filter:


EventArgs:


Zone Volume Changed

Occurs when the current volume setting for the player changes.

Whenever Filter:


EventArgs:


Zone Mute State Changed

Occurs when the current mute setting for the player changes.

Whenever Filter:


EventArgs:


Zone Mode Changed

Occurs when the player's mode changes.

Whenever Filter:


EventArgs:


Zone Shuffle State Changed

Occurs when the shuffle state of the player changes.

Whenever Filter:


EventArgs:


Zone Repeat Mode Changed

Occurs when the repeat mode of the player changes.

Whenever Filter:


EventArgs:


Zone Playlist Position Changed

Occurs when the index of the currently playing song changes on a zone.

Whenever Filter:


EventArgs:


Zone Playlist Length Changed

Occurs when the total number of tracks in a zone's playlist changes.

Whenever Filter:


EventArgs:


Zone Playlist Name Changed

Occurs when the name of the currently playing playlist changes on a zone.

Whenever Filter:


EventArgs:


Zone Playlist URL Changed

Occurs when the URL of the currently playing playlist changes on a zone.

Whenever Filter:


EventArgs:


Ready State Changed

The device's running and ready state changed.

Whenever Filter:

none

EventArgs:


Playing

Occurs when the player mode changes to playing.

Whenever Filter:

none

EventArgs:

none

Paused

Occurs when the player mode changes to paused.

Whenever Filter:

none

EventArgs:

none

Track Changed

Occurs when the currently playing song changes.

Whenever Filter:

none

EventArgs:

none

Instance Properties

ZoneNames

Gets the name of all zones.

Accessibility : Read Only

Type: Array

ZoneCurrentTrackArtists

Gets the current track's artist property for all zones.

Accessibility : Read Only

Type: Array

ZoneCurrentTrackAlbums

Gets the current track's album property for all zones.

Accessibility : Read Only

Type: Array

ZoneCurrentTrackTitles

Gets the current track's title property for all zones.

Accessibility : Read Only

Type: Array

ZoneCurrentTrackGenres

Gets the current track's genre property for all zones.

Accessibility : Read Only

Type: Array

ZoneVolumes

Gets or sets the current volume setting for the player zones. The scale is 0 to 100.

Accessibility : Read Only

Type: Array

ZoneMuteStates

Gets or sets a value indicating if a zone's volume setting for the player is muted.

Accessibility : Read Only

Type: Array

ZoneTransportModes

Gets or sets a zone's transport mode as 'play', 'stop' or 'pause'.

Accessibility : Read Only

Type: Array

Connected

Gets the connected state of the player, true if the driver is connected to the iTunes application, otherwise false.

Accessibility : Read Only

Type: Boolean

ZoneCount

Gets the number of zones supported by this media player driver.

Accessibility : Read Only

Type: Number

ZoneCurrentTrackDurations

Gets the duration of a zone's currently playing song.

Accessibility : Read Only

Type: Array

ZoneCurrentTrackPositions

Gets or sets the current time position that the each zone's current song has been playing.

Accessibility : Read Only

Type: Array

ZoneCurrentTrackPaths

Gets the path for the currently playing track for each zone.

Accessibility : Read Only

Type: Array

ZoneShuffleStates

Gets or set the shuffle state of a zone playlist.

Accessibility : Read Only

Type: Array

ZoneRepeatModes

Gets or sets the repeat mode which indicates if the player will stop playing at the end of the zone's playlist, repeat the current song indefinitely, or repeat the zone's playlist indefinitely. A value of '0' indicates that the player will stop at the end of the playlist, '1' indicates that the player will repeat the current song indefinitely and a value of '2' indicates that the player will repeat the entire playlist indefinitely.

Accessibility : Read Only

Type: Array

ZonePlaylistPositions

Gets or sets the playlist song position that is currently playing by index. When setting, a one-based value may be used to indicate which song to play.

Accessibility : Read Only

Type: Array

ZonePlaylistLengths

Gets the total number of tracks in each zone's playlist.

Accessibility : Read Only

Type: Array

ZonePlaylistNames

Gets the playlist name that is currently playing by zone.

Accessibility : Read Only

Type: Array

ZonePlaylistUrls

Gets the playlist URL that is currently playing by zone.

Accessibility : Read Only

Type: Array

ZoneCurrentTrackCoverArts

Gets the cover art for the each zone's current track.

Accessibility : Read Only

Type: Array

DeviceDisplayName

The display name for this device.

Accessibility : Read Only

Type: String

DeviceStartTime

The date and time when this device was started.

Accessibility : Read Only

Type: DateTime

DeviceLifecycleStage

The current lifecycle stage of the device. The stages in order are: Pending Start, Starting, Running, Stopping

Accessibility : Read Only

Type: Number

DeviceIsRunningAndReady

Indicates if the device is ready for use, ie it is in the Running lifecycle stage and all properties are valid and all methods are ready to be used.

Accessibility : Read Only

Type: Boolean

Instance Methods

PlayZone ( Number )

Starts playing the a zone's playlist.

Syntax

void PlayZone( Number zoneID )

Parameters

zoneID : The zone to play.

StopZone ( Number )

Stops playing the a zone's playlist.

Syntax

void StopZone( Number zoneID )

Parameters

zoneID : The zone to stop.

PauseZone ( Number )

Pauses the playing of a zone's playlist.

Syntax

void PauseZone( Number zoneID )

Parameters

zoneID : The zone to pause.

ToggleZonePause ( Number )

Toggles the pause state of a zone's playlist.

Syntax

void ToggleZonePause( Number zoneID )

Parameters

zoneID : The zone to toggle pause.

PlayNextZoneTrack ( Number )

Plays the next track in a zone's playlist.

Syntax

void PlayNextZoneTrack( Number zoneID )

Parameters

zoneID : The zone to toggle pause.

PlayPreviousZoneTrack ( Number )

Plays the previous track in a zone's playlist.

Syntax

void PlayPreviousZoneTrack( Number zoneID )

Parameters

zoneID : The zone to toggle pause.

PlayZoneItem ( Number, String )

Adds the specified song track path, url, or iTunes playlist name into a zone's playlist and plays starting at the first item. Any songs previously in the playlist are discarded.

Syntax

void PlayZoneItem( Number zoneID, String item )

Parameters

zoneID : The zone number to play the item on.
item : A song track path, url, or iTunes playlist name.

PlayZoneItems ( Number, Array )

Adds the song track path, url, or iTunes playlist name into a zone's playlist and plays starting at the first item. Any songs previously in the playlist are discarded.

Syntax

void PlayZoneItems( Number zoneID, Array locations )

Parameters

zoneID : The zone number to play the items on.
locations : An array of ScriptString objects representing song URLs, playlists, files or directory paths.

ClearZonePlaylist ( Number )

Clears a zone's playlist and stops the player.

Syntax

void ClearZonePlaylist( Number zoneID )

Parameters

zoneID : The zone number.

SetZoneVolume ( Number, Number )

Change the Volume for a Zone.

Syntax

void SetZoneVolume( Number zoneID, Number volume )

Parameters

zoneID : The zone number.
volume : Volume (0=Quietest, 100=Loudest)

OffsetZoneVolume ( Number, Number )

Offsets the current volume setting for the player. Positive numbers increase the volume by the specified number and negative numbers decrease the volume. The full volume scale is 0 to 100.

Syntax

void OffsetZoneVolume( Number zoneID, Number offset )

Parameters

zoneID : The zone to toggle pause.
offset : The amount to offset the volume.

MuteZone ( Number )

Turn the mute on for a zone.

Syntax

void MuteZone( Number zoneID )

Parameters

zoneID : The zone number to mute.

UnmuteZone ( Number )

Turn the mute off for a zone.

Syntax

void UnmuteZone( Number zoneID )

Parameters

zoneID : The zone number to unmute.

SetZoneTransportMode ( Number, String )

Set's a zone's transport mode as 'play', 'stop' or 'pause'.

Syntax

void SetZoneTransportMode( Number zoneID, String mode )

Parameters

zoneID : The zone number.
mode : The mode, one of 'play', 'stop', or 'pause'.

SetZoneCurrentTrackPosition ( Number, TimeSpan )

Set's a zone's track position.

Syntax

void SetZoneCurrentTrackPosition( Number zoneID, unknown position )

Parameters

zoneID : The zone number.
position : The track position.

SetPropertyForDuration ( String, TimeSpan, Object, Object )

Sets a property for a duration of time and then sets the property to a subequent value asynchronously. This action returns after setting the first value and the timer and subsequent property set run in the background. Subsequent sets of the same property will reset the timer if the subsequent value has not yet been set. This is an advanced feature, be sure to set the property name correctly.

Syntax

void SetPropertyForDuration( String propertyName, unknown duration, Object initialValue, Object finalValue )

Parameters

propertyName : The name of the property to set.
duration : The amount of time to wait after setting the initial value to set the subsequent value.
initialValue : The value to set the property to initially.
finalValue : The value to set the property to after the duration of time has passed.

SetPropertyForDuration ( String, Number, TimeSpan, Object, Object )

Sets a property for a duration of time and then sets the property to a subequent value asynchronously. This action returns after setting the first value and the timer and subsequent property set run in the background. Subsequent sets of the same property will reset the timer if the subsequent value has not yet been set. This is an advanced feature, be sure to set the property name correctly.

Syntax

void SetPropertyForDuration( String propertyName, Number arrayIndex, unknown duration, Object initialValue, Object finalValue )

Parameters

propertyName : The name of the property to set.
arrayIndex : The property's array index to set.
duration : The amount of time to wait after setting the initial value to set the subsequent value.
initialValue : The value to set the property to initially.
finalValue : The value to set the property to after the duration of time has passed.