Enum MediaType

  • All Implemented Interfaces:
    Serializable, Comparable<MediaType>

    public enum MediaType
    extends Enum<MediaType>
    上传的媒体类型

    公众平台上传限制:
    图片(image): 2MB,支持bmp/png/jpeg/jpg/gif格式
    语音(voice):2MB,播放长度不超过60s,支持mp3/wma/wav/amr格式
    视频(video):10MB,支持rm/rmvb/wmv/avi/mpg/mpeg/mp4格式
    缩略图(thumb):64KB,支持JPG格式

    企业号上传限制:
    图片(image):1MB,支持bmp/png/jpeg/jpg/gif格式
    语音(voice):2MB,播放长度不超过60s,支持mp3/wma/wav/amr格式
    视频(video):10MB,支持rm/rmvb/wmv/avi/mpg/mpeg/mp4格式
    普通文件(file):20MB

    临时媒体文件在后台保存时间为3天,即3天后media_id失效

    Since:
    JDK 1.6
    Author:
    jinyu(foxinmy@gmail.com)
    • Method Detail

      • values

        public static MediaType[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (MediaType c : MediaType.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static MediaType valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • getMimeType

        public MimeType getMimeType()