mc.previewMedia(Object object)

预览图片和视频。

Object object 参数

属性 类型 默认值 必填 说明
sources [Object] 需要预览的资源列表
current Number 0 当前显示的资源序号
showmenu Boolean true 是否显示长按菜单
referrerPolicy String no-referrer origin: 发送完整的 referrer; no-referrer: 不发送。
success Function 接口调用成功的回调函数
fail Function 接口调用失败的回调函数
complete Function 接口调用结束的回调函数(调用成功、失败都会执行)

Object.sources 的结构

属性 类型 默认值 必填 说明
url String 图片或视频的地址
type String image 资源的类型,默认为图片
poster String 视频的封面图片

type 的合法值

说明 最低版本
image 图片
video 视频  

示例代码:

mc.previewMedia({
  sources:[
    {url: 'https://test1', type: 'video', poster: 'https://test/poster.png'},
    {url: 'http://test2', type: 'image'},
    {url: 'https://test3', type: 'video', poster: ''},
    {url: 'http://test4', type: 'image'},
  ]
})

results matching ""

    No results matching ""

    results matching ""

      No results matching ""