ASTrack Class Reference
Inherits from | ASObject : NSObject |
Declared in | ASTrack.h |
Overview
Tracks are the heart of the platform, and represent a playable piece of music. Methods for Searching and streaming tracks are documented in detail above. For speedy results, many track attributes are omitted when searching via an ASPaginator. However by using the ‘with’ parameter when performing a search additional attributes or their ids can be retrieved. See the Audiosocket searching API docs for more details on the ‘with’ parameter. All attributes can be retrieved from the track’s /tracks/:id singular resource.
Many of the track properties are a list of ids. These IDs can be ‘resolved’ by using the ASContext. Typically you’ll want to load the context once then resolve ids using:
NSArray *genres = [context resolveIDs:track.genreIDs forClass:[ASGenre class]];
Tasks
Track attributes
-
length
The track duration in seconds as a floating-point number.
property -
album
An object representing the track’s album.
property -
artist
An object representing this track’s artist.
property -
endingID
ID of the track’s ending.
property -
introID
ID of the track’s intro.
property -
explicit
Does this track contain adult language? A boolean.
property -
genreIDs
Array of genre ids. Only populated if the ‘with’ parameter was specified when a search was performed or if the track was retrieved via a load call.
property -
instrumentsIDs
Array of instrument ids. Only populated if the ‘with’ parameter was specified when a search was performed or if the track was retrieved via a load call.
property -
languagesIDs
Array of language ids. Only populated if the ‘with’ parameter was specified when a search was performed or if the track was retrieved via a load call.
property -
moodsIDs
Array of mood ids. Only populated if the ‘with’ parameter was specified when a search was performed or if the track was retrieved via a load call.
property -
restrictionsIDs
Array of restriction ids. Only populated if the ‘with’ parameter was specified when a search was performed or if the track was retrieved via a load call.
property -
temposIDs
Array of tempo ids. Only populated if the ‘with’ parameter was specified when a search was performed or if the track was retrieved via a load call.
property -
themesIDs
Array of theme ids. Only populated if the ‘with’ parameter was specified when a search was performed or if the track was retrieved via a load call.
property -
vocalsIDs
Array of vocal ids. Only populated if the ‘with’ parameter was specified when a search was performed or if the track was retrieved via a load call.
property
Streaming content
-
streamingURL
URL to stream this track from. Streaming URL not available until loaded via loadStreamingURLWithSuccess:success:failure. This URL provides a 128k stereo MP3 with a lifetime of about 11 hours.
property -
– loadStreamingURLWithSuccess:failure:
Initiates a request to get the a temporary URL that can be then used to stream this track’s audio. This URL provides a 128k stereo MP3 with a lifetime of about 11 hours.
Properties
album
An object representing the track’s album.
@property (strong, readonly) ASAlbum *album
Declared In
ASTrack.h
artist
An object representing this track’s artist.
@property (strong, readonly) ASArtist *artist
Declared In
ASTrack.h
explicit
Does this track contain adult language? A boolean.
@property (readonly) BOOL explicit
Declared In
ASTrack.h
genreIDs
Array of genre ids. Only populated if the ‘with’ parameter was specified when a search was performed or if the track was retrieved via a load call.
@property (strong, readonly) NSArray *genreIDs
Declared In
ASTrack.h
instrumentsIDs
Array of instrument ids. Only populated if the ‘with’ parameter was specified when a search was performed or if the track was retrieved via a load call.
@property (strong, readonly) NSArray *instrumentsIDs
Declared In
ASTrack.h
languagesIDs
Array of language ids. Only populated if the ‘with’ parameter was specified when a search was performed or if the track was retrieved via a load call.
@property (strong, readonly) NSArray *languagesIDs
Declared In
ASTrack.h
length
The track duration in seconds as a floating-point number.
@property (strong, readonly) NSNumber *length
Declared In
ASTrack.h
moodsIDs
Array of mood ids. Only populated if the ‘with’ parameter was specified when a search was performed or if the track was retrieved via a load call.
@property (strong, readonly) NSArray *moodsIDs
Declared In
ASTrack.h
restrictionsIDs
Array of restriction ids. Only populated if the ‘with’ parameter was specified when a search was performed or if the track was retrieved via a load call.
@property (strong, readonly) NSArray *restrictionsIDs
Declared In
ASTrack.h
streamingURL
URL to stream this track from. Streaming URL not available until loaded via loadStreamingURLWithSuccess:success:failure. This URL provides a 128k stereo MP3 with a lifetime of about 11 hours.
@property (strong, readonly) NSURL *streamingURL
Declared In
ASTrack.h
temposIDs
Array of tempo ids. Only populated if the ‘with’ parameter was specified when a search was performed or if the track was retrieved via a load call.
@property (strong, readonly) NSArray *temposIDs
Declared In
ASTrack.h
Instance Methods
loadStreamingURLWithSuccess:failure:
Initiates a request to get the a temporary URL that can be then used to stream this track’s audio. This URL provides a 128k stereo MP3 with a lifetime of about 11 hours.
- (void)loadStreamingURLWithSuccess:(void ( ^ ) ( ASTrack *track ))success failure:(void ( ^ ) ( NSError *error ))failure
Parameters
- success
Invoked, if provided, when the request returns. This track is passed to the supplied block. You can then access the URL to stream from using track.streamingURL.
- failure
Invoked, if provided, when the request encounters an error.
Declared In
ASTrack.h