[TOC]

跳过导航链接

cn.jpush.im.android.api.content

类 VoiceContent

    • 所有已实现的接口:
    • java.lang.Cloneable

public class VoiceContent
extends MediaContent

构造器概要

构造器 构造器和说明 VoiceContent(java.io.File voiceFile, int duration)

方法概要

所有方法 实例方法;) 具体方法;) 限定符和类型 方法和说明 void cancelDownload(Message message) 取消下载,手动下载后可调用此接口取消下载, 注意可以自动下载的文件不可取消

是否取消成功需要根据下载的回调来判断,如果取消成功,下载回调中错误码为ErrorCode.LOCAL_ERROR#LOCAL_OPERATION_CANCELLED void downloadVoiceFile(Message message, DownloadCompletionCallback callback) 下载语音消息中的语音文件。 int getDuration() 获取语音文件时长 boolean needAutoDownloadWhenRecv()

-    

从类继承的方法 cn.jpush.im.android.api.content.MediaContent

getCrc, getFileSize, getFormat, getHash, getLocalPath, getMediaID, getResourceId, isFileUploaded, setFileUploaded, setFormat, setLocalPath, setMediaID

-    

从类继承的方法 cn.jpush.im.android.api.content.MessageContent

clone, fromJson, getBooleanExtra, getBooleanExtras, getContentType, getNumberExtra, getNumberExtras, getStringExtra, getStringExtras, setBooleanExtra, setExtras, setNumberExtra, setStringExtra, toJson, toJsonElement

-    

从类继承的方法 java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

构造器详细资料

-  

VoiceContent

public VoiceContent(java.io.File voiceFile,
                    int duration)
             throws java.io.FileNotFoundException
  - 抛出: 
  - <code>java.io.FileNotFoundException</code>        

方法详细资料

-  

needAutoDownloadWhenRecv

public boolean needAutoDownloadWhenRecv()
  - 指定者: 
  - <code>needAutoDownloadWhenRecv</code> 在类中 <code>MessageContent</code>        
-  

getDuration

public int getDuration()

获取语音文件时长

  - 返回: 
  - 语音文件的时长        
-  

downloadVoiceFile

public void downloadVoiceFile(Message message,
                              DownloadCompletionCallback callback)

下载语音消息中的语音文件。

sdk会在接收到语音消息时自动下载语音文件,仅当自动下载失败, 消息状态为receive_fail时,需要用户调用此接口手动下载。

  - 参数: 
  - <code>message</code> - 语音消息对象 
  - <code>callback</code> - 下载完成时的回调接口        
-  

cancelDownload

public void cancelDownload(Message message)

从类复制的说明: MessageContent

取消下载,手动下载后可调用此接口取消下载, 注意可以自动下载的文件不可取消

是否取消成功需要根据下载的回调来判断,如果取消成功,下载回调中错误码为ErrorCode.LOCAL_ERROR#LOCAL_OPERATION_CANCELLED

  - 指定者: 
  - <code>cancelDownload</code> 在类中 <code>MessageContent</code> 
  - 参数: 
  - <code>message</code> - 该Content所对应的消息对象       

跳过导航链接