java.lang.Object | |||
↳ | java.util.Observable | ||
↳ | fm.audiobox.core.models.Model | ||
↳ | fm.audiobox.core.models.MediaFile |
Media Files are the most important entity in the platform, has many properties, are editable, deletable and streamable.
Not every media container is supported by AudioBox, you can find this information in the user.json
API
call by looking user.accepted_extensions
and user.accepted_formats
.
Media Files uploaded into AudioBox Cloud will use storage space that will count toward the monthly bill of the User. Please always check the permissions.cloud value prior to attempt an upload since a subscription might no be in good standing.
Developers can request to stream a file in any moment.
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
protected String | album | The Album. | |||||||||
protected String | albumArtist | The Album artist. | |||||||||
protected String | artist | The Artist. | |||||||||
protected String | artwork | The Artwork. | |||||||||
protected String | audioBitrate | The Audio bitrate. | |||||||||
protected String | audioCodec | The Audio codec. | |||||||||
protected String | audioSampleRate | The Audio sample rate. | |||||||||
protected String | comment | The Comment. | |||||||||
protected String | composer | The Composer. | |||||||||
protected int | discNumber | The Disc number. | |||||||||
protected String | filename | The Filename. | |||||||||
protected String | genre | The Genre. | |||||||||
protected String | hash | The Hash. | |||||||||
protected int | lenInt | The duration in seconds. | |||||||||
protected String | lenStr | The duration string formatted. | |||||||||
protected boolean | loved | The Loved. | |||||||||
protected String | lyrics | The Lyrics. | |||||||||
protected String | mediaFileName | The Media file name. | |||||||||
protected String | mime | The Mime. | |||||||||
protected int | position | The Position. | |||||||||
protected int | releaseYear | The Release year. | |||||||||
protected String | remotePath | The Remote path. | |||||||||
protected String | shareToken | The Share token. | |||||||||
protected long | size | The Size. | |||||||||
protected String | source | The Source. | |||||||||
protected String | title | The Title. | |||||||||
protected String | token | The Token. | |||||||||
protected String | type | The Type. | |||||||||
protected String | videoAspect | The Video aspect ratio. | |||||||||
protected String | videoBitrate | The Video bitrate. | |||||||||
protected String | videoCodec | The Video codec. | |||||||||
protected String | videoContainer | The Video container. | |||||||||
protected String | videoFps | The Video FPS. | |||||||||
protected String | videoResolution | The Video resolution. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
MediaFile()
Instantiates a new Playlist.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
boolean |
destroy(AudioBoxClient audioBoxClient)
Handle a single media file destruction synchronously.
| ||||||||||
OutputStream |
download(AudioBoxClient audioBoxClient, OutputStream out)
Downloads the media to specified java.io.OutputStream
| ||||||||||
OutputStream |
download(AudioBoxClient audioBoxClient, OutputStream out, NetworkProgressListener listener)
Downloads the media to specified java.io.OutputStream
| ||||||||||
String |
getAlbum()
Album name, automatically set depending on the Cloud Drive in use if not set.
| ||||||||||
String |
getAlbumArtist()
Album Artist name.
| ||||||||||
String |
getArtist()
Artist name, automatically set depending on the Cloud Drive in use, if not set.
| ||||||||||
String |
getArtwork()
Represents the path for the Artwork of a Media File on the HTTP(S) CDN m.audiobox.fm.
| ||||||||||
String |
getAudioBitrate()
Indicates the bitrate in case of AudioFile or the first audio track in a VideoFile.
| ||||||||||
String |
getAudioCodec()
Indicates the codec in case of AudioFile or the first audio track in a VideoFile.
| ||||||||||
String |
getAudioSampleRate()
Indicates the sample rate in case of AudioFile or the first audio track in a VideoFile.
| ||||||||||
String |
getComment()
Gets custom comment.
| ||||||||||
String |
getComposer()
Composer name.
| ||||||||||
int |
getDiscNumber()
Represents the number of the disc in a multi collection set.
| ||||||||||
String |
getDownloadPath()
Gets download path for this media file.
| ||||||||||
String |
getDownloadUrl(AudioBoxClient audioBoxClient)
Gets download url for this media file.
| ||||||||||
String |
getFilename()
File name indicating where the file has been stored on our systems.
| ||||||||||
String |
getGenre()
Genre name, automatically set depending on the Cloud Drive in use if not set.
| ||||||||||
String |
getHash()
MD5 Hash of the Media File.
| ||||||||||
int |
getLenInt()
Represents the duration in seconds of the media file.
| ||||||||||
String |
getLenStr()
Formatted as "3:04" to ease display in views.
| ||||||||||
String |
getLyrics(AudioBoxClient audioBoxClient)
Loads the media file lyrics from AudioBox.
| ||||||||||
String |
getMime()
Formatted such as "audio/mpeg", represents the recognized mime type for this file.
| ||||||||||
static String |
getPath()
Gets the generic remote resource path (token interpolation is needed).
| ||||||||||
int |
getPosition()
Represents the position this Media File occupy in a collection/album (track's number).
| ||||||||||
int |
getReleaseYear()
Four integers, represents the year when the Media File has been released.
| ||||||||||
String |
getRemotePath()
Used along with some Cloud Drives to help the platform identifying where this file is stored for retrieval.
| ||||||||||
String |
getShareToken()
Shared token across multiple Media Files with the same artist/album combo that builds up a Share URL, such as:
http://audiobox.fm/share/cfa4b55e1736415b491147f041b95392 | ||||||||||
long |
getSize()
Physical size of the Media File, in bytes.
| ||||||||||
String |
getSource()
Represents where this Media File comes from.
| ||||||||||
String |
getStreamPath()
Gets stream path for this media file.
| ||||||||||
String |
getStreamUrl(AudioBoxClient audioBoxClient, boolean secure)
Gets stream url for this media file.
| ||||||||||
String |
getTitle()
The title of this Media File.
| ||||||||||
String |
getToken()
Gets token, identify uniquely this Media File in the system.
| ||||||||||
String |
getType()
Gets the media file type, can be either 'AudioFile' or 'VideoFile'.
| ||||||||||
String |
getVideoAspect()
Indicates the aspect ratio in case of VideoFile.
| ||||||||||
String |
getVideoBitrate()
Indicates the codec in case of VideoFile.
| ||||||||||
String |
getVideoCodec()
Indicates the codec in case of VideoFile.
| ||||||||||
String |
getVideoContainer()
Indicates the container in case of VideoFile.
| ||||||||||
String |
getVideoFps()
Indicates the frame per second in case of VideoFile.
| ||||||||||
String |
getVideoResolution()
Indicates the resolution in case of VideoFile.
| ||||||||||
boolean |
isLoved()
Indicates if this Media File is 'loved' by its owner or not.
| ||||||||||
static MediaFile |
load(AudioBoxClient audioBoxClient, String token)
Load a single media file.
| ||||||||||
MediaFile |
love(AudioBoxClient audioBoxClient)
Manually 'love' a Media File
This will also trigger love/like on all supported and linked remote services, such as Last.fm/Facebook.
| ||||||||||
MediaFile |
reload(AudioBoxClient audioBoxClient)
(Re)load a new instance of the same media file.
| ||||||||||
MediaFile |
scrobble(AudioBoxClient audioBoxClient)
Notify the system that this media file finished playing.
| ||||||||||
void |
setAlbum(String album)
Sets album.
| ||||||||||
void |
setAlbumArtist(String albumArtist)
Sets album artist name.
| ||||||||||
void |
setArtist(String artist)
Sets artist.
| ||||||||||
void |
setArtwork(String artwork)
Sets artwork.
| ||||||||||
void |
setAudioBitrate(String audioBitrate)
Sets audio bitrate.
| ||||||||||
void |
setAudioCodec(String audioCodec)
Sets audio codec.
| ||||||||||
void |
setAudioSampleRate(String audioSampleRate)
Sets audio sample rate.
| ||||||||||
void |
setComment(String comment)
Sets comment.
| ||||||||||
void |
setComposer(String composer)
Sets composer.
| ||||||||||
void |
setDiscNumber(int discNumber)
Sets disc number.
| ||||||||||
void |
setFilename(String filename)
Sets filename.
| ||||||||||
void |
setGenre(String genre)
Sets genre.
| ||||||||||
void |
setHash(String hash)
Sets hash.
| ||||||||||
void |
setLenInt(int lenInt)
Sets len int.
| ||||||||||
void |
setLenStr(String lenStr)
Sets length in string format
| ||||||||||
void |
setLoved(boolean loved)
Sets loved.
| ||||||||||
void |
setLyrics(String lyrics)
Sets lyrics.
| ||||||||||
void |
setMediaFileName(String mediaFileName)
Sets media file name.
| ||||||||||
void |
setMime(String mime)
Sets mime.
| ||||||||||
void |
setPosition(int position)
Sets position.
| ||||||||||
void |
setReleaseYear(int releaseYear)
Sets release year.
| ||||||||||
void |
setRemotePath(String remotePath)
Sets remote path.
| ||||||||||
void |
setShareToken(String shareToken)
Sets share token.
| ||||||||||
void |
setSize(long size)
Sets size.
| ||||||||||
void |
setSource(String source)
Sets source.
| ||||||||||
void |
setTitle(String title)
Sets title.
| ||||||||||
void |
setToken(String token)
Sets token.
| ||||||||||
void |
setType(String type)
Sets type.
| ||||||||||
void |
setVideoAspect(String videoAspect)
Sets video aspect.
| ||||||||||
void |
setVideoBitrate(String videoBitrate)
Sets video bitrate.
| ||||||||||
void |
setVideoCodec(String videoCodec)
Sets video codec.
| ||||||||||
void |
setVideoContainer(String videoContainer)
Sets video container.
| ||||||||||
void |
setVideoFps(String videoFps)
Sets video fps.
| ||||||||||
void |
setVideoResolution(String videoResolution)
Sets video resolution.
| ||||||||||
MediaFile |
toggleLove(AudioBoxClient audioBoxClient)
Switch the loved attribute to true/false and fire off remote services notifications.
| ||||||||||
MediaFile |
unlove(AudioBoxClient audioBoxClient)
Manually 'unlove' a Media File
This will also trigger 'unlove' on all supported and linked remote services, such as Last.fm/Facebook/Google Drive.
| ||||||||||
MediaFile |
update(AudioBoxClient audioBoxClient)
Handle a single media file update.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
fm.audiobox.core.models.Model
| |||||||||||
From class
java.util.Observable
| |||||||||||
From class
java.lang.Object
|
The Album.
The Album artist.
The Artist.
The Artwork.
The Audio bitrate.
The Audio codec.
The Audio sample rate.
The Comment.
The Composer.
The Disc number.
The Filename.
The Genre.
The Hash.
The duration in seconds.
The duration string formatted.
The Loved.
The Lyrics.
The Media file name.
The Mime.
The Position.
The Release year.
The Remote path.
The Share token.
The Size.
The Source.
The Title.
The Token.
The Type.
The Video aspect ratio.
The Video bitrate.
The Video codec.
The Video container.
The Video FPS.
The Video resolution.
Instantiates a new Playlist.
Default empty constructor.Handle a single media file destruction synchronously.
If you need to permanently destroy more than one single media file in one sweep usedestroyAll(fm.audiobox.core.AudioBoxClient, java.util.List)
Do not attempt to call this endpoint for single tracks the user selected to destroy.
This will remove the media file from our database. If the media file is stored on AudioBox Cloud it will be
physically removed as well. If the media file is stored on a remote storage solution like AudioBox Desktop,
Dropbox, SkyDrive, etc. it will not be harmed unless management mode is enabled.audioBoxClient | the client to use for the request |
---|
AudioBoxException | if any of the remote error exception is detected. |
---|---|
IOException |
Downloads the media to specified java.io.OutputStream
audioBoxClient | client the to use for the request |
---|---|
out | the desired OutputStream where to store the downloaded data |
IOException | if any network communication or IO occurs |
---|
Downloads the media to specified java.io.OutputStream
audioBoxClient | client the to use for the request |
---|---|
out | the desired OutputStream where to store the downloaded data |
listener | a NetworkProgressListener for monitoring download progress |
IOException | if any network communication or IO occurs |
---|
Album name, automatically set depending on the Cloud Drive in use if not set.
Album Artist name. Useful to differentiate between compilations.
Artist name, automatically set depending on the Cloud Drive in use, if not set.
Represents the path for the Artwork of a Media File on the HTTP(S) CDN m.audiobox.fm. 256x256. 1.5MB Max. PNG/JPEG/GIF.
Indicates the bitrate in case of AudioFile or the first audio track in a VideoFile.
Indicates the codec in case of AudioFile or the first audio track in a VideoFile.
Indicates the sample rate in case of AudioFile or the first audio track in a VideoFile.
Gets custom comment.
Composer name.
Represents the number of the disc in a multi collection set.
Gets download path for this media file.
Gets download url for this media file.
audioBoxClient | the Client instance to grab env configuration from |
---|
File name indicating where the file has been stored on our systems.
Genre name, automatically set depending on the Cloud Drive in use if not set.
MD5 Hash of the Media File.
Represents the duration in seconds of the media file.
Formatted as "3:04" to ease display in views. Represents the duration of the media file.
Loads the media file lyrics from AudioBox.
audioBoxClient | client the to use for the request |
---|
AudioBoxException | if any of the remote error exception is detected. |
---|---|
IOException |
Formatted such as "audio/mpeg", represents the recognized mime type for this file. This value can help some client to better recognize the type of file to be streamed.
Gets the generic remote resource path (token interpolation is needed).
Represents the position this Media File occupy in a collection/album (track's number).
Four integers, represents the year when the Media File has been released.
Used along with some Cloud Drives to help the platform identifying where this file is stored for retrieval.
Shared token across multiple Media Files with the same artist/album combo that builds up a Share URL, such as:
http://audiobox.fm/share/cfa4b55e1736415b491147f041b95392
Physical size of the Media File, in bytes.
Represents where this Media File comes from. Possible values are: 'cloud', 'local', 'dropbox', 'skydrive', 'box', 'gdrive', 'youtube', 'soundcloud', 'mega'.
Gets stream path for this media file.
Gets stream url for this media file.
Some device does not support SSL streaming (such as old Android), in this case
you are forced to serve via canonical HTTP protocol (secure = false
).
audioBoxClient | the Client instance to grab env configuration from |
---|---|
secure | whether to serve the SSL protected stream url or not |
The title of this Media File.
Gets token, identify uniquely this Media File in the system.
Gets the media file type, can be either 'AudioFile' or 'VideoFile'.
Indicates the aspect ratio in case of VideoFile.
Indicates the codec in case of VideoFile.
Indicates the codec in case of VideoFile.
Indicates the container in case of VideoFile.
Indicates the frame per second in case of VideoFile.
Indicates the resolution in case of VideoFile.
Indicates if this Media File is 'loved' by its owner or not. Default is false.
Load a single media file.
audioBoxClient | client the to use for the request |
---|---|
token | the token that uniquely identify the media file |
ResourceNotFoundException | if the requested media was not found on AudioBox. |
---|---|
IOException |
Manually 'love' a Media File
This will also trigger love/like on all supported and linked remote services, such as Last.fm/Facebook. You can also 'love' the media file by issuing a PUT update request and setting the attribute 'loved' to true, but this will not notifying any remote services. Last.fm will see a track as loved, Facebook as liked, Google Drive as starred, and so on.audioBoxClient | client the to use for the request |
---|
AudioBoxException | if any of the remote error exception is detected. |
---|---|
IOException |
(Re)load a new instance of the same media file.
audioBoxClient | client the to use for the request |
---|
ResourceNotFoundException | if the requested media was not found on AudioBox. |
---|---|
IOException |
Notify the system that this media file finished playing.
This endpoint is highly recommended to be used and should be called when the Media File is approaching the end of the stream. Triggers different actions in the system, such as Scrobbling to Last.fm and much more.audioBoxClient | client the to use for the request |
---|
AudioBoxException | if any of the remote error exception is detected. |
---|---|
IOException |
Sets album.
album | the album |
---|
Sets album artist name.
albumArtist | the album artist |
---|
Sets artist.
artist | the artist |
---|
Sets artwork.
artwork | the artwork |
---|
Sets audio bitrate.
audioBitrate | the audio bitrate |
---|
Sets audio codec.
audioCodec | the audio codec |
---|
Sets audio sample rate.
audioSampleRate | the audio sample rate |
---|
Sets comment.
comment | the comment |
---|
Sets composer.
composer | the composer |
---|
Sets disc number.
discNumber | the disc number |
---|
Sets filename.
filename | the filename |
---|
Sets genre.
genre | the genre |
---|
Sets hash.
hash | the hash |
---|
Sets len int.
lenInt | the len int |
---|
Sets length in string format
lenStr | the media duration in string format |
---|
Sets loved.
loved | the loved |
---|
Sets lyrics.
lyrics | the lyrics |
---|
Sets media file name.
mediaFileName | the media file name |
---|
Sets mime.
mime | the mime |
---|
Sets position.
position | the position |
---|
Sets release year.
releaseYear | the release year |
---|
Sets remote path.
remotePath | the remote path |
---|
Sets share token.
shareToken | the share token |
---|
Sets size.
size | the size |
---|
Sets source.
source | the source |
---|
Sets title.
title | the title |
---|
Sets token.
token | the token |
---|
Sets type.
type | the type |
---|
Sets video aspect.
videoAspect | the video aspect |
---|
Sets video bitrate.
videoBitrate | the video bitrate |
---|
Sets video codec.
videoCodec | the video codec |
---|
Sets video container.
videoContainer | the video container |
---|
Sets video fps.
videoFps | the video fps |
---|
Sets video resolution.
videoResolution | the video resolution |
---|
Switch the loved attribute to true/false and fire off remote services notifications.
This is useful for application that care about the loved attribute after it's being set. Preserve all the features of the love and unlove endpoints.audioBoxClient | client the to use for the request |
---|
AudioBoxException | if any of the remote error exception is detected. |
---|---|
IOException |
Manually 'unlove' a Media File
This will also trigger 'unlove' on all supported and linked remote services, such as Last.fm/Facebook/Google Drive. You can also 'unlove' the media file by issuing a PUT update request and setting the attribute 'loved' to false, but this will not notifying any remote services. Last.fm will see a track as unloved, Facebook as unliked, Google Drive as not starred, and so on.audioBoxClient | client the to use for the request |
---|
AudioBoxException | if any of the remote error exception is detected. |
---|---|
IOException |
Handle a single media file update.
audioBoxClient | the client to use for the request |
---|
AudioBoxException | if any of the remote error exception is detected. |
---|---|
IOException |