IMSDK
IM features a comprehensive suite of solutions including global access, one-to-one chat, group chat, message push, profile and relationship chain hosting, and account authentication. It also provides complete app access and backend management APIs.
V2TIMSoundElem

Public Member Functions

String getPath ()
 
String getUUID ()
 
int getDataSize ()
 
int getDuration ()
 
void downloadSound (String path, final V2TIMDownloadCallback v2TIMDownloadCallback)
 
void getUrl (final V2TIMValueCallback< String > callback)
 
void convertVoiceToText (String language, final V2TIMValueCallback< String > callback)
 
String toString ()
 
V2TIMElem getNextElem ()
 
void appendElem (V2TIMElem v2TIMElem)
 

Member Function Documentation

◆ getPath()

String getPath ( )
inline

Get the path to the voice file to be sent (valid only for the message sender)

Returns
Voice file path

◆ getUUID()

String getUUID ( )
inline

Internal ID of the voice message

Returns

◆ getDataSize()

int getDataSize ( )
inline

Voice data size

Returns

◆ getDuration()

int getDuration ( )
inline

Voice duration (seconds)

Returns

◆ downloadSound()

void downloadSound ( String  path,
final V2TIMDownloadCallback  v2TIMDownloadCallback 
)
inline

Download voice The downloadSound API downloads files from the server each time. If cache or storage is required, you can use UUIDs as keys for external storage. The IM SDK does not store resource files.

Parameters
pathVoice save path, which must be specified externally
v2TIMDownloadCallbackCallback

◆ getUrl()

void getUrl ( final V2TIMValueCallback< String >  callback)
inline

Get the voice download URL

◆ convertVoiceToText()

void convertVoiceToText ( String  language,
final V2TIMValueCallback< String >  callback 
)
inline

Convert the voice to text (supported only in 7.4 and later versions).

Parameters
languageRecognition language of voice.
Attention
  • Converting voice to text is a value-added payment feature, and now is in the stage of internal testing. You can join Tencent Cloud IM Group to contact us to activate this feature for you.

◆ toString()

String toString ( )
inline

◆ getNextElem()

V2TIMElem getNextElem ( )
inlineinherited

◆ appendElem()

void appendElem ( V2TIMElem  v2TIMElem)
inlineinherited

Add the next element

To configure multiple elements, you can add the next element via the element of a Message object after creating the Message object.

The following is the sample code for creating V2TIMTextElem and V2TIMCustomElem elements:

V2TIMMessage message = V2TIMManager.getMessageManager().createTextMessage("test");

V2TIMCustomElem customElem = new V2TIMCustomElem();

customElem.setData("Custom message".getBytes());

message.getTextElem().appendElem(customElem);

Attention
  • This API can be called only by elements of a Message object created via createMessage.
  • This API can be used to add elements only of the V2TIMTextElem, V2TIMCustomElem, V2TIMFaceElem, and V2TIMLocationElem types.