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.
V2TIMSoundElemabstract
Swift - V2TIMSoundElem
Swift

Class V2TIMSound​Elem

public class V2TIMSoundElem : V2TIMElem  

Definition of V2TIMSoundElem

V2TIMSoundElem V2TIMSoundElem V2TIMElem V2TIMElem V2TIMSoundElem->V2TIMElem

Superclass

V2TIMElem

Definition of V2TIMElem

Initializers

init()

public override init()  

Properties

path

public var path: String?  

The path of the audio file to be sent (can only be called by the message sender)

uuid

public var uuid: String?  

The internal ID of a voice message

data​Size

public var dataSize: Int  

The voice data size

duration

public var duration: Int  

The voice duration (seconds)

Methods

get​Url(callback:​)

public func getUrl(callback: @escaping (String?) -> (Void))  

Get the voice downlaod URL

download​Sound(path:​progress:​succ:​fail:​)

public func downloadSound(path: String, progress: V2TIMDownLoadProgress?, succ: V2TIMSucc?, fail: V2TIMFail?)  

Download audio. This API downloads data from the server. To cache or store the data, you can use the UUID as the key. The Chat SDK does not store the files.

Parameters

path String

The path to which the audio file is saved. It must be specified externally.

convert​Voice​ToText(language:​completion:​)

public func convertVoiceToText(language: String, completion:V2TIMConvertVoiceToTextCompletion?)  

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

  • Converting voice to text is a paid value-added feature and is now in beta testing. To try the feature, join our Tencent Cloud IM Group.

Parameters

language String

The language of the voice recognized.