public class MediaFile extends Model
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.
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
album
The Album.
|
protected java.lang.String |
albumArtist
The Album artist.
|
protected java.lang.String |
artist
The Artist.
|
protected java.lang.String |
artwork
The Artwork.
|
protected java.lang.String |
audioBitrate
The Audio bitrate.
|
protected java.lang.String |
audioCodec
The Audio codec.
|
protected java.lang.String |
audioSampleRate
The Audio sample rate.
|
protected java.lang.String |
comment
The Comment.
|
protected java.lang.String |
composer
The Composer.
|
protected int |
discNumber
The Disc number.
|
protected java.lang.String |
filename
The Filename.
|
protected java.lang.String |
genre
The Genre.
|
protected java.lang.String |
hash
The Hash.
|
protected int |
lenInt
The duration in seconds.
|
protected java.lang.String |
lenStr
The duration string formatted.
|
protected boolean |
loved
The Loved.
|
protected java.lang.String |
lyrics
The Lyrics.
|
protected java.lang.String |
mediaFileName
The Media file name.
|
protected java.lang.String |
mime
The Mime.
|
protected int |
position
The Position.
|
protected int |
releaseYear
The Release year.
|
protected java.lang.String |
remotePath
The Remote path.
|
protected java.lang.String |
shareToken
The Share token.
|
protected long |
size
The Size.
|
protected java.lang.String |
source
The Source.
|
protected java.lang.String |
title
The Title.
|
protected java.lang.String |
token
The Token.
|
protected java.lang.String |
type
The Type.
|
protected java.lang.String |
videoAspect
The Video aspect ratio.
|
protected java.lang.String |
videoBitrate
The Video bitrate.
|
protected java.lang.String |
videoCodec
The Video codec.
|
protected java.lang.String |
videoContainer
The Video container.
|
protected java.lang.String |
videoFps
The Video FPS.
|
protected java.lang.String |
videoResolution
The Video resolution.
|
| Constructor and Description |
|---|
MediaFile()
Instantiates a new Playlist.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
destroy(AudioBoxClient audioBoxClient)
Handle a single media file destruction synchronously.
|
java.io.OutputStream |
download(AudioBoxClient audioBoxClient,
java.io.OutputStream out)
Downloads the media to specified
OutputStream |
java.io.OutputStream |
download(AudioBoxClient audioBoxClient,
java.io.OutputStream out,
NetworkProgressListener listener)
Downloads the media to specified
OutputStream |
java.lang.String |
getAlbum()
Album name, automatically set depending on the Cloud Drive in use if not set.
|
java.lang.String |
getAlbumArtist()
Album Artist name.
|
java.lang.String |
getArtist()
Artist name, automatically set depending on the Cloud Drive in use, if not set.
|
java.lang.String |
getArtwork()
Represents the path for the Artwork of a Media File on the HTTP(S) CDN m.audiobox.fm. 256x256. 1.5MB Max.
|
java.lang.String |
getAudioBitrate()
Indicates the bitrate in case of AudioFile or the first audio track in a VideoFile.
|
java.lang.String |
getAudioCodec()
Indicates the codec in case of AudioFile or the first audio track in a VideoFile.
|
java.lang.String |
getAudioSampleRate()
Indicates the sample rate in case of AudioFile or the first audio track in a VideoFile.
|
java.lang.String |
getComment()
Gets custom comment.
|
java.lang.String |
getComposer()
Composer name.
|
int |
getDiscNumber()
Represents the number of the disc in a multi collection set.
|
java.lang.String |
getDownloadPath()
Gets download path for this media file.
|
java.lang.String |
getDownloadUrl(AudioBoxClient audioBoxClient)
Gets download url for this media file.
|
java.lang.String |
getFilename()
File name indicating where the file has been stored on our systems.
|
java.lang.String |
getGenre()
Genre name, automatically set depending on the Cloud Drive in use if not set.
|
java.lang.String |
getHash()
MD5 Hash of the Media File.
|
int |
getLenInt()
Represents the duration in seconds of the media file.
|
java.lang.String |
getLenStr()
Formatted as "3:04" to ease display in views.
|
java.lang.String |
getLyrics(AudioBoxClient audioBoxClient)
Loads the media file lyrics from AudioBox.
|
java.lang.String |
getMime()
Formatted such as "audio/mpeg", represents the recognized mime type for this file.
|
static java.lang.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.
|
java.lang.String |
getRemotePath()
Used along with some Cloud Drives to help the platform identifying where this file is stored for retrieval.
|
java.lang.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.
|
java.lang.String |
getSource()
Represents where this Media File comes from.
|
java.lang.String |
getStreamPath()
Gets stream path for this media file.
|
java.lang.String |
getStreamUrl(AudioBoxClient audioBoxClient,
boolean secure)
Gets stream url for this media file.
|
java.lang.String |
getTitle()
The title of this Media File.
|
java.lang.String |
getToken()
Gets token, identify uniquely this Media File in the system.
|
java.lang.String |
getType()
Gets the media file type, can be either 'AudioFile' or 'VideoFile'.
|
java.lang.String |
getVideoAspect()
Indicates the aspect ratio in case of VideoFile.
|
java.lang.String |
getVideoBitrate()
Indicates the codec in case of VideoFile.
|
java.lang.String |
getVideoCodec()
Indicates the codec in case of VideoFile.
|
java.lang.String |
getVideoContainer()
Indicates the container in case of VideoFile.
|
java.lang.String |
getVideoFps()
Indicates the frame per second in case of VideoFile.
|
java.lang.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,
java.lang.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(java.lang.String album)
Sets album.
|
void |
setAlbumArtist(java.lang.String albumArtist)
Sets album artist name.
|
void |
setArtist(java.lang.String artist)
Sets artist.
|
void |
setArtwork(java.lang.String artwork)
Sets artwork.
|
void |
setAudioBitrate(java.lang.String audioBitrate)
Sets audio bitrate.
|
void |
setAudioCodec(java.lang.String audioCodec)
Sets audio codec.
|
void |
setAudioSampleRate(java.lang.String audioSampleRate)
Sets audio sample rate.
|
void |
setComment(java.lang.String comment)
Sets comment.
|
void |
setComposer(java.lang.String composer)
Sets composer.
|
void |
setDiscNumber(int discNumber)
Sets disc number.
|
void |
setFilename(java.lang.String filename)
Sets filename.
|
void |
setGenre(java.lang.String genre)
Sets genre.
|
void |
setHash(java.lang.String hash)
Sets hash.
|
void |
setLenInt(int lenInt)
Sets len int.
|
void |
setLenStr(java.lang.String lenStr)
Sets length in string format
|
void |
setLoved(boolean loved)
Sets loved.
|
void |
setLyrics(java.lang.String lyrics)
Sets lyrics.
|
void |
setMediaFileName(java.lang.String mediaFileName)
Sets media file name.
|
void |
setMime(java.lang.String mime)
Sets mime.
|
void |
setPosition(int position)
Sets position.
|
void |
setReleaseYear(int releaseYear)
Sets release year.
|
void |
setRemotePath(java.lang.String remotePath)
Sets remote path.
|
void |
setShareToken(java.lang.String shareToken)
Sets share token.
|
void |
setSize(long size)
Sets size.
|
void |
setSource(java.lang.String source)
Sets source.
|
void |
setTitle(java.lang.String title)
Sets title.
|
void |
setToken(java.lang.String token)
Sets token.
|
void |
setType(java.lang.String type)
Sets type.
|
void |
setVideoAspect(java.lang.String videoAspect)
Sets video aspect.
|
void |
setVideoBitrate(java.lang.String videoBitrate)
Sets video bitrate.
|
void |
setVideoCodec(java.lang.String videoCodec)
Sets video codec.
|
void |
setVideoContainer(java.lang.String videoContainer)
Sets video container.
|
void |
setVideoFps(java.lang.String videoFps)
Sets video fps.
|
void |
setVideoResolution(java.lang.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.
|
getProp, notifyObservers, setPropprotected java.lang.String type
protected java.lang.String token
protected java.lang.String artist
protected java.lang.String album
protected java.lang.String genre
protected int releaseYear
protected java.lang.String title
protected java.lang.String lenStr
protected int lenInt
protected int position
protected java.lang.String filename
protected java.lang.String mediaFileName
protected boolean loved
protected int discNumber
protected java.lang.String mime
protected java.lang.String remotePath
protected java.lang.String source
protected java.lang.String shareToken
protected java.lang.String artwork
protected long size
protected java.lang.String albumArtist
protected java.lang.String hash
protected java.lang.String composer
protected java.lang.String comment
protected java.lang.String videoBitrate
protected java.lang.String videoCodec
protected java.lang.String videoResolution
protected java.lang.String videoFps
protected java.lang.String videoAspect
protected java.lang.String videoContainer
protected java.lang.String audioBitrate
protected java.lang.String audioCodec
protected java.lang.String audioSampleRate
protected java.lang.String lyrics
public MediaFile()
public static java.lang.String getPath()
public java.lang.String getStreamPath()
public java.lang.String getStreamUrl(AudioBoxClient audioBoxClient, boolean secure)
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 fromsecure - whether to serve the SSL protected stream url or notpublic java.lang.String getDownloadPath()
public java.lang.String getDownloadUrl(AudioBoxClient audioBoxClient)
audioBoxClient - the Client instance to grab env configuration frompublic static MediaFile load(AudioBoxClient audioBoxClient, java.lang.String token) throws java.io.IOException
audioBoxClient - client the to use for the requesttoken - the token that uniquely identify the media fileResourceNotFoundException - if the requested media was not found on AudioBox.java.io.IOExceptionpublic MediaFile reload(AudioBoxClient audioBoxClient) throws java.io.IOException
audioBoxClient - client the to use for the requestResourceNotFoundException - if the requested media was not found on AudioBox.java.io.IOExceptionpublic java.io.OutputStream download(AudioBoxClient audioBoxClient, java.io.OutputStream out) throws java.io.IOException
OutputStreamaudioBoxClient - client the to use for the requestout - the desired OutputStream where to store the downloaded datajava.io.IOException - if any network communication or IO occurspublic java.io.OutputStream download(AudioBoxClient audioBoxClient, java.io.OutputStream out, NetworkProgressListener listener) throws java.io.IOException
OutputStreamaudioBoxClient - client the to use for the requestout - the desired OutputStream where to store the downloaded datalistener - a NetworkProgressListener for monitoring download progressjava.io.IOException - if any network communication or IO occurspublic MediaFile update(AudioBoxClient audioBoxClient) throws java.io.IOException
audioBoxClient - the client to use for the requestAudioBoxException - if any of the remote error exception is detected.java.io.IOExceptionpublic boolean destroy(AudioBoxClient audioBoxClient) throws java.io.IOException
MediaFiles.destroyAll(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 requestAudioBoxException - if any of the remote error exception is detected.java.io.IOExceptionpublic MediaFile scrobble(AudioBoxClient audioBoxClient) throws java.io.IOException
audioBoxClient - client the to use for the requestAudioBoxException - if any of the remote error exception is detected.java.io.IOExceptionpublic java.lang.String getLyrics(AudioBoxClient audioBoxClient) throws java.io.IOException
audioBoxClient - client the to use for the requestAudioBoxException - if any of the remote error exception is detected.java.io.IOExceptionpublic MediaFile love(AudioBoxClient audioBoxClient) throws java.io.IOException
audioBoxClient - client the to use for the requestAudioBoxException - if any of the remote error exception is detected.java.io.IOExceptionpublic MediaFile unlove(AudioBoxClient audioBoxClient) throws java.io.IOException
audioBoxClient - client the to use for the requestAudioBoxException - if any of the remote error exception is detected.java.io.IOExceptionpublic MediaFile toggleLove(AudioBoxClient audioBoxClient) throws java.io.IOException
audioBoxClient - client the to use for the requestAudioBoxException - if any of the remote error exception is detected.java.io.IOExceptionpublic java.lang.String getType()
public java.lang.String getToken()
public java.lang.String getArtist()
public void setArtist(java.lang.String artist)
artist - the artistpublic java.lang.String getAlbum()
public void setAlbum(java.lang.String album)
album - the albumpublic java.lang.String getGenre()
public void setGenre(java.lang.String genre)
genre - the genrepublic int getReleaseYear()
public void setReleaseYear(int releaseYear)
releaseYear - the release yearpublic java.lang.String getTitle()
public void setTitle(java.lang.String title)
title - the titlepublic java.lang.String getLenStr()
public int getLenInt()
public int getPosition()
public void setPosition(int position)
position - the positionpublic java.lang.String getFilename()
public boolean isLoved()
public void setLoved(boolean loved)
loved - the lovedpublic int getDiscNumber()
public void setDiscNumber(int discNumber)
discNumber - the disc numberpublic java.lang.String getMime()
public java.lang.String getRemotePath()
public java.lang.String getSource()
public java.lang.String getShareToken()
http://audiobox.fm/share/cfa4b55e1736415b491147f041b95392public java.lang.String getArtwork()
public void setArtwork(java.lang.String artwork)
artwork - the artworkpublic long getSize()
public java.lang.String getAlbumArtist()
public void setAlbumArtist(java.lang.String albumArtist)
albumArtist - the album artistpublic java.lang.String getHash()
public java.lang.String getComposer()
public void setComposer(java.lang.String composer)
composer - the composerpublic java.lang.String getComment()
public void setComment(java.lang.String comment)
comment - the commentpublic java.lang.String getVideoBitrate()
public java.lang.String getVideoCodec()
public java.lang.String getVideoResolution()
public java.lang.String getVideoFps()
public java.lang.String getVideoAspect()
public java.lang.String getVideoContainer()
public java.lang.String getAudioBitrate()
public java.lang.String getAudioCodec()
public java.lang.String getAudioSampleRate()
public void setType(java.lang.String type)
type - the typepublic void setToken(java.lang.String token)
token - the tokenpublic void setLenStr(java.lang.String lenStr)
lenStr - the media duration in string formatpublic void setLenInt(int lenInt)
lenInt - the len intpublic void setFilename(java.lang.String filename)
filename - the filenamepublic void setMediaFileName(java.lang.String mediaFileName)
mediaFileName - the media file namepublic void setMime(java.lang.String mime)
mime - the mimepublic void setRemotePath(java.lang.String remotePath)
remotePath - the remote pathpublic void setSource(java.lang.String source)
source - the sourcepublic void setShareToken(java.lang.String shareToken)
shareToken - the share tokenpublic void setSize(long size)
size - the sizepublic void setHash(java.lang.String hash)
hash - the hashpublic void setVideoBitrate(java.lang.String videoBitrate)
videoBitrate - the video bitratepublic void setVideoCodec(java.lang.String videoCodec)
videoCodec - the video codecpublic void setVideoResolution(java.lang.String videoResolution)
videoResolution - the video resolutionpublic void setVideoFps(java.lang.String videoFps)
videoFps - the video fpspublic void setVideoAspect(java.lang.String videoAspect)
videoAspect - the video aspectpublic void setVideoContainer(java.lang.String videoContainer)
videoContainer - the video containerpublic void setAudioBitrate(java.lang.String audioBitrate)
audioBitrate - the audio bitratepublic void setAudioCodec(java.lang.String audioCodec)
audioCodec - the audio codecpublic void setAudioSampleRate(java.lang.String audioSampleRate)
audioSampleRate - the audio sample ratepublic void setLyrics(java.lang.String lyrics)
lyrics - the lyrics