public interface WxCpMediaService
媒体管理接口 Created by BinaryWang on 2017/6/24.
| 限定符和类型 | 方法和说明 |
|---|---|
File |
download(String mediaId)
下载多媒体文件
根据微信文档,视频文件下载不了,会返回null
详情请见: http://mp.weixin.qq.com/wiki/index.php?
|
WxMediaUploadResult |
upload(String mediaType,
File file) |
WxMediaUploadResult |
upload(String mediaType,
String fileType,
InputStream inputStream)
上传多媒体文件
上传的多媒体文件有格式和大小限制,如下:
图片(image): 1M,支持JPG格式
语音(voice):2M,播放长度不超过60s,支持AMR\MP3格式
视频(video):10MB,支持MP4格式
缩略图(thumb):64KB,支持JPG格式
详情请见: http://mp.weixin.qq.com/wiki/index.php?
|
WxMediaUploadResult upload(String mediaType, String fileType, InputStream inputStream) throws WxErrorException, IOException
上传多媒体文件 上传的多媒体文件有格式和大小限制,如下: 图片(image): 1M,支持JPG格式 语音(voice):2M,播放长度不超过60s,支持AMR\MP3格式 视频(video):10MB,支持MP4格式 缩略图(thumb):64KB,支持JPG格式 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=上传下载多媒体文件
mediaType - 媒体类型, 请看WxConstsfileType - 文件类型,请看WxConstsinputStream - 输入流WxErrorExceptionIOExceptionWxMediaUploadResult upload(String mediaType, File file) throws WxErrorException
mediaType - 媒体类型file - 文件对象WxErrorExceptionupload(String, String, InputStream)File download(String mediaId) throws WxErrorException
下载多媒体文件 根据微信文档,视频文件下载不了,会返回null 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=上传下载多媒体文件
mediaId - 媒体idWxErrorExceptionCopyright © 2017. All rights reserved.