Fleet Mobile
Search Results for

    Show / Hide Table of Contents

    Class MediaHelper

    媒体辅助静态类

    Inheritance
    object
    MediaHelper
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: Fleet.Mobile.Containers.Media
    Assembly: FleetMobile.dll
    Syntax
    public static class MediaHelper

    Fields

    MaxAttachmentSingleLength

    最大单个附件大小,单位字节,默认值 20_971_520 (MaxAttachmentSingleLengthMB * 1024 * 1024)

    Declaration
    public const int MaxAttachmentSingleLength = 20971520
    Field Value
    int

    MaxAttachmentSingleLengthMB

    最大单个附件大小,单位 MB,默认值 20

    Declaration
    public const int MaxAttachmentSingleLengthMB = 20
    Field Value
    int

    MaxAttachmentVideoCount

    最大视频附件个数,默认值 3

    Declaration
    public const int MaxAttachmentVideoCount = 3
    Field Value
    int

    MaxBitrateKb

    最大码率,单位 Kb,默认值 3500

    Declaration
    public const int MaxBitrateKb = 3500
    Field Value
    int

    MaxImageHeight

    最大图片高度,默认值 1440

    Declaration
    public const int MaxImageHeight = 1440
    Field Value
    int

    MaxImageWidth

    最大图片宽度,默认值 2560

    Declaration
    public const int MaxImageWidth = 2560
    Field Value
    int

    MaxVideoLengthSec

    最大视频长度,单位秒,默认值 25

    Declaration
    public const int MaxVideoLengthSec = 25
    Field Value
    int

    MaxVideoLengthUs

    最大视频长度,单位微秒,默认值 25_000_000 (MaxVideoLengthSec * 1000L * 1000L)

    Declaration
    public const long MaxVideoLengthUs = 25000000
    Field Value
    long

    ScanDelay

    扫码识别延迟,默认 2000ms

    Declaration
    public const int ScanDelay = 2000
    Field Value
    int

    Properties

    MaxAttachmentLength

    获取最大附件允许大小,单位字节,默认值 104_857_600 (MaxAttachmentLengthMB * 1024 * 1024)

    Declaration
    public static int MaxAttachmentLength { get; }
    Property Value
    int

    MaxAttachmentLengthMB

    获取最大附件允许大小,单位 MB,默认值 100

    Declaration
    public static int MaxAttachmentLengthMB { get; }
    Property Value
    int

    Methods

    GuessImageExtension(byte[])

    根据数据内容获取相应格式的扩展名。

    Declaration
    public static string GuessImageExtension(byte[] data)
    Parameters
    byte[] data

    文件数据

    Returns
    string

    返回格式的扩展名

    IsPicture(string)

    根据扩展名判断是否为图片格式。

    Declaration
    public static bool IsPicture(string ext)
    Parameters
    string ext

    扩展名

    Returns
    bool

    true 则表示该类型为图片类型

    IsUrlType(string)

    根据字符串判断是否为 URL 类型。

    Declaration
    public static bool IsUrlType(string type)
    Parameters
    string type

    类型字符串

    Returns
    bool

    true 则表示类型忽略大小写等于 "URL"

    IsVideo(string)

    根据扩展名判断是否为视频格式。

    Declaration
    public static bool IsVideo(string ext)
    Parameters
    string ext

    扩展名

    Returns
    bool

    true 则表示该类型为视频类型

    PickMediaAsync(Action<float>, int)

    弹出媒体选择器并返回选择结果。

    Declaration
    public static Task<IEnumerable<PickerFile>> PickMediaAsync(Action<float> step, int maxLimit = 50)
    Parameters
    Action<float> step

    进度处理回调

    int maxLimit

    最大选择数量限制,默认 50

    Returns
    Task<IEnumerable<PickerFile>>

    返回选择的文件枚举

    ReadFromFileAsync(PickerFile, Stream, bool, long)

    Declaration
    public static Task<MediaItem> ReadFromFileAsync(PickerFile file, Stream fs, bool editing = false, long limit = 20971520)
    Parameters
    PickerFile file

    Stream fs

    bool editing

    long limit

    Returns
    Task<MediaItem>

    ResizeImage(byte[])

    若图片数据大于 400KB,则压缩图片数据,压缩格式为 Jpeg,质量 90,最大分辨率不超过 (MaxImageWidth, MaxImageHeight)。

    Declaration
    public static byte[] ResizeImage(byte[] content)
    Parameters
    byte[] content

    图片数据

    Returns
    byte[]

    返回压缩后的数据

    ResizeImageOld(byte[])

    若图片数据大于 400KB,则压缩图片数据,最大分辨率不超过 (MaxImageWidth, MaxImageHeight)。

    Declaration
    public static byte[] ResizeImageOld(byte[] content)
    Parameters
    byte[] content

    图片数据

    Returns
    byte[]

    返回压缩后的数据

    TakePhotoAsync()

    弹出拍照页面并返回图片文件结果。

    Declaration
    public static Task<MediaPickerFile> TakePhotoAsync()
    Returns
    Task<MediaPickerFile>

    返回图片文件

    TakeVideoAsync(Action<float>)

    弹出录像页面并返回视频文件结果。

    Declaration
    public static Task<MediaPickerFile> TakeVideoAsync(Action<float> step)
    Parameters
    Action<float> step

    进度处理回调

    Returns
    Task<MediaPickerFile>

    返回视频文件

    WrapPdfUrl(string)

    获取包装后的 pdf 超链接。(暂未使用)

    Declaration
    public static string WrapPdfUrl(string url)
    Parameters
    string url

    URL 字符串

    Returns
    string

    返回包装后的 URL

    In this article
    Back to top Generated by DocFX