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
-
lengthThe track duration in seconds as a floating-point number.
property -
albumAn object representing the track’s album.
property -
artistAn object representing this track’s artist.
property -
endingIDID of the track’s ending.
property -
introIDID of the track’s intro.
property -
explicitDoes this track contain adult language? A boolean.
property -
genreIDsArray 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 -
instrumentsIDsArray 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 -
languagesIDsArray 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 -
moodsIDsArray 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 -
restrictionsIDsArray 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 -
temposIDsArray 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 -
themesIDsArray 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 -
vocalsIDsArray 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
-
streamingURLURL 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 *albumDeclared In
ASTrack.hartist
An object representing this track’s artist.
@property (strong, readonly) ASArtist *artistDeclared In
ASTrack.hexplicit
Does this track contain adult language? A boolean.
@property (readonly) BOOL explicitDeclared In
ASTrack.hgenreIDs
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 *genreIDsDeclared In
ASTrack.hinstrumentsIDs
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 *instrumentsIDsDeclared In
ASTrack.hlanguagesIDs
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 *languagesIDsDeclared In
ASTrack.hlength
The track duration in seconds as a floating-point number.
@property (strong, readonly) NSNumber *lengthDeclared In
ASTrack.hmoodsIDs
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 *moodsIDsDeclared In
ASTrack.hrestrictionsIDs
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 *restrictionsIDsDeclared In
ASTrack.hstreamingURL
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 *streamingURLDeclared In
ASTrack.htemposIDs
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 *temposIDsDeclared In
ASTrack.hInstance 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 ))failureParameters
- 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