Chat Android SDK  7.0.1
com.twilio.chat.Message.Media Class Reference

Media object describes downloadable media inside chat message with type Message.Type.MEDIA. More...

Public Member Functions

Getters
String getSid ()
 Get SID of media stream. More...
 
String getFileName ()
 Get file name of media stream. More...
 
String getType ()
 Get mime-type of media stream. More...
 
long getSize ()
 Get size of media stream. More...
 
void getContentTemporaryUrl (CallbackListener< String > listener)
 Request media download temporary link. More...
 
Actions
void download (OutputStream stream, StatusListener status, ProgressListener progress)
 Save media content stream that could be streamed or downloaded by client. More...
 

Detailed Description

Media object describes downloadable media inside chat message with type Message.Type.MEDIA.

Member Function Documentation

void com.twilio.chat.Message.Media.download ( OutputStream  stream,
StatusListener  status,
ProgressListener  progress 
)

Save media content stream that could be streamed or downloaded by client.

Provided stream could be any subclass of java.io.OutputStream, including ByteArrayOutputStream, so you could download media into memory for further processing.

Deprecated:
For effective downloading use getContentTemporaryUrl method to get temporary direct link and download media by URL.
Parameters
streamOutput stream to write media to.
statusStatus listener receives result status of the download operation. If download is successful, listener.onSuccess() will be called, otherwise listener.onError().
progressProgress listener receives updates about media download starting (progress.onStarted()), bytes downloaded (progress.onProgress(bytes)) and completed (progress.onCompleted()).
Exceptions
IllegalArgumentExceptionWhen attempt is made to use null output stream.
void com.twilio.chat.Message.Media.getContentTemporaryUrl ( CallbackListener< String >  listener)

Request media download temporary link.

This URL is impermanent, it expires in several minutes. If the link became invalid (expired), need to re-request the new one. It is user's responsibility to timely download media data by this link.

Parameters
listenerListener to receive temporary URL.
String com.twilio.chat.Message.Media.getFileName ( )

Get file name of media stream.

Returns
file name of media stream.
String com.twilio.chat.Message.Media.getSid ( )

Get SID of media stream.

Returns
SID of media stream.
long com.twilio.chat.Message.Media.getSize ( )

Get size of media stream.

Returns
size of media stream.
String com.twilio.chat.Message.Media.getType ( )

Get mime-type of media stream.

Returns
mime-type string of media stream.