更新记录

1.0.0(2026-05-28)

v-download

Android 原生 文件下载管理 UTS 插件,支持普通 HTTP 下载与 M3U8 下载合并

功能

功能 说明
普通下载 HTTP/HTTPS,支持断点续传(Range)
M3U8 解析主/子播放列表、下载 TS 分片、AES-128 解密、合并输出
任务管理 暂停 / 继续 / 取消 / 删除 / 列表查询
进度回调 progress 实时返回进度、速度、状态
持久化 任务列表保存至应用私有目录

快速使用

import {
  startDownload,
  pauseDownload,
  resumeDownload,
  cancelDownload,
  removeDownload,
  getDownloadList,
  getDownloadTask,
  clearCompleted
} from '@/uni_modules/v-download'

// 普通文件
startDownload({
  url: 'https://example.com/video.mp4',
  fileName: 'video.mp4',
  saveDir: 'movies',
  progress: (p) => {
    console.log(p.progress, p.status, p.speed)
  },
  success: (task) => {
    console.log('任务ID', task.taskId, task.savePath)
  },
  fail: (err) => console.log(err.errMsg)
})

// M3U8(type 可省略,URL 含 .m3u8 会自动识别)
startDownload({
  url: 'https://example.com/live/index.m3u8',
  fileName: 'output.mp4',
  type: 'm3u8',
  headers: { referer: 'https://example.com', userAgent: 'Mozilla/5.0' },
  progress: (p) => { /* ... */ }
})

pauseDownload({ taskId: 'dl_xxx' })
resumeDownload({ taskId: 'dl_xxx' })
cancelDownload({ taskId: 'dl_xxx' })
removeDownload({ taskId: 'dl_xxx' })

const { list } = getDownloadList()
const task = getDownloadTask('dl_xxx')
clearCompleted()

API

startDownload(options)

参数 类型 说明
url String 下载地址(必填)
fileName String 保存文件名
saveDir String 相对下载根目录的子文件夹
type String auto / file / m3u8
headers Object userAgent / referer / cookie
progress Function 进度回调(会多次触发;插件已对 startDownload 使用 @UTSJS.keepAlive
success / fail / complete Function 标准回调

同步方法

  • getDownloadList(){ list: DownloadTaskInfo[] }
  • getDownloadTask(taskId)DownloadTaskInfo | null
  • clearCompleted() → 清除数量

任务状态

pending · downloading · paused · completed · failed · cancelled

M3U8 说明

  • 自动选择 最高码率 子播放列表
  • 分片并发下载(3 线程)
  • 支持 AES-128 加密(#EXT-X-KEY
  • 合并方式为 TS 分片 二进制拼接(输出 .mp4 扩展名,实质为 TS 流;多数播放器可播放)
  • 如需标准 MP4 转码,需自行接入 FFmpeg

存储路径

Android/data/<包名>/files/v-download/

调试

  1. HBuilderX 制作 自定义调试基座
  2. 运行 pages/download/download.vue
  3. 确保 manifest 含 INTERNET 权限

错误码(90 开头)

说明
9030001 地址无效
9030002 任务不存在
9030003 状态不允许
9030004 M3U8/下载失败
9030005 写入失败
9030006 已取消

平台兼容性

uni-app(4.0)

Vue2 Vue2插件版本 Vue3 Vue3插件版本 Chrome Safari app-vue app-nvue Android iOS 鸿蒙
1.0.0 1.0.0 × × - -
微信小程序 支付宝小程序 抖音小程序 百度小程序 快手小程序 京东小程序 鸿蒙元服务 QQ小程序 飞书小程序 小红书小程序 快应用-华为 快应用-联盟
- - - - - - - - - - - -

v-download

Android 原生 文件下载管理 UTS 插件,支持普通 HTTP 下载与 M3U8 下载合并

功能

功能 说明
普通下载 HTTP/HTTPS,支持断点续传(Range)
M3U8 解析主/子播放列表、下载 TS 分片、AES-128 解密、合并输出
任务管理 暂停 / 继续 / 取消 / 删除 / 列表查询
进度回调 progress 实时返回进度、速度、状态
持久化 任务列表保存至应用私有目录

快速使用

import {
  startDownload,
  pauseDownload,
  resumeDownload,
  cancelDownload,
  removeDownload,
  getDownloadList,
  getDownloadTask,
  clearCompleted
} from '@/uni_modules/v-download'

// 普通文件
startDownload({
  url: 'https://example.com/video.mp4',
  fileName: 'video.mp4',
  saveDir: 'movies',
  progress: (p) => {
    console.log(p.progress, p.status, p.speed)
  },
  success: (task) => {
    console.log('任务ID', task.taskId, task.savePath)
  },
  fail: (err) => console.log(err.errMsg)
})

// M3U8(type 可省略,URL 含 .m3u8 会自动识别)
startDownload({
  url: 'https://example.com/live/index.m3u8',
  fileName: 'output.mp4',
  type: 'm3u8',
  headers: { referer: 'https://example.com', userAgent: 'Mozilla/5.0' },
  progress: (p) => { /* ... */ }
})

pauseDownload({ taskId: 'dl_xxx' })
resumeDownload({ taskId: 'dl_xxx' })
cancelDownload({ taskId: 'dl_xxx' })
removeDownload({ taskId: 'dl_xxx' })

const { list } = getDownloadList()
const task = getDownloadTask('dl_xxx')
clearCompleted()

API

startDownload(options)

参数 类型 说明
url String 下载地址(必填)
fileName String 保存文件名
saveDir String 相对下载根目录的子文件夹
type String auto / file / m3u8
headers Object userAgent / referer / cookie
progress Function 进度回调(会多次触发;插件已对 startDownload 使用 @UTSJS.keepAlive
success / fail / complete Function 标准回调

同步方法

  • getDownloadList(){ list: DownloadTaskInfo[] }
  • getDownloadTask(taskId)DownloadTaskInfo | null
  • clearCompleted() → 清除数量

任务状态

pending · downloading · paused · completed · failed · cancelled

M3U8 说明

  • 自动选择 最高码率 子播放列表
  • 分片并发下载(3 线程)
  • 支持 AES-128 加密(#EXT-X-KEY
  • 合并方式为 TS 分片 二进制拼接(输出 .mp4 扩展名,实质为 TS 流;多数播放器可播放)
  • 如需标准 MP4 转码,需自行接入 FFmpeg

存储路径

Android/data/<包名>/files/v-download/

调试

  1. HBuilderX 制作 自定义调试基座
  2. 运行 pages/download/download.vue
  3. 确保 manifest 含 INTERNET 权限

错误码(90 开头)

说明
9030001 地址无效
9030002 任务不存在
9030003 状态不允许
9030004 M3U8/下载失败
9030005 写入失败
9030006 已取消

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

插件不采集任何数据

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

暂无用户评论。