Developers

Actions

Not only can ye use th’ onsong:// URL scheme t’ import content into OnSong, but ye can also use it t’ perform actions in OnSong. Any action that can be performed with a foot pedal or screen tap can be performed in OnSong usin’ th’ URL API.

Requirements

Th’ Actions URL API requires th’ current version o’ OnSong. Ye can join our beta team t’ get pre-release versions o’ OnSong fer testin’. Since th’ onsong:// URL scheme be used on every version o’ OnSong, ye’ll want t’ ensure ye only have th’ beta version installed t’ avoid conflict with other versions o’ th’ app.

Checkin’ Installation

O’ course t’ use any o’ these API calls, ye’ll need t’ ensure th’ user has OnSong installed on their device. T’ do this, add onsong as a registered URL scheme. Without this, yer app will not be able t’ open OnSong scheme. However this does not apply t’ web-based apps.

Once registered, ye can use th’ [UIApplication canOpenURL:] method t’ determine if th’ URL can be opened. If that returns false, then th’ OnSong app be not installed and ye can present an appropriate user interface t’ have th’ user install OnSong. Fer instance, through an affiliate link. Ye can request t’ become an affiliate partner with OnSong by emailin’ us.

Discover Actions

At th’ most basic form, actions can be performed by just callin’ th’ action by its name. With so many actions, this can be difficult t’ memorize. Th’ most important call here be list. This will return a list o’ dictionary objects that represent each supported action.

onsong://action/list

This will export th’ JSON-formatted list t’ th’ file sharin’ location. Ye can retrieve th’ list fer review by connectin’ yer device t’ a Mac and usin’ Finder, or t’ a Windows PC and usin’ th’ Apple Devices app. If ye rather send th’ list t’ another app or website, ye can append a returnURL parameter. This will Base64 encode th’ JSON-formatted list and append it t’ th’ end o’ th’ URL:

onsong://action/list?returnURL=myapp%3A%2F%2Fretrieve-actions%2F%3Fdata%3D

Th’ returned list contains parameters:

  • action be th’ unique value t’ send t’ perform th’ action.
  • title be th’ conversational name o’ th’ action, a combination o’ a noun and verb.
  • momentary determines if this be a momentary action that be performed simply by callin’ th’ action.
  • variable determines if th’ action expects a variable amount as input t’ perform th’ action.
  • parameters be a dictionary o’ parameters that can be sent t’ th’ action usin’ th’ query string. Th’ value o’ th’ dictionary field contains information about what th’ parameter contains includin’:
    • title be th’ conversational name o’ th’ parameter.
    • type be th’ type o’ value expected such as a string, integer, float, etc.
    • minimumValue determines th’ lowest value accepted fer numeric types.
    • maximumValue determines th’ highest value accepted fer numeric types.
    • format determines how numeric types should be formatted.

Perform Momentary Actions

Most actions in OnSong be momentary and can be performed with a simple tap o’ th’ screen or press o’ a foot pedal. T’ perform these actions with th’ URL API, just call th’ URL usin’ th’ action value. T’ scroll down th’ current song in th’ song viewer, use this:

onsong://action/ForwardPedalWasPressed

Perform Variable Actions

Variable actions usually take input from a variable control that can be between 0-100%. Fer these, we need t’ pass an amount parameter in th’ query string. T’ scroll th’ screen t’ th’ 50% position in th’ song, use this:

onsong://action/PositionWasAdjusted?amount=0.5

Perform Parameterized Actions

More advanced actions require more specific input t’ perform. Fer instance, t’ switch t’ th’ chorus o’ th’ song, we could use this action:

onsong://action/SongSectionWasPressed?sectionID=Chorus