更新记录
1.0.1(2026-05-09)
修复鸿蒙版本关闭页面提示异常。
1.0.0(2026-05-09)
初始化发布。
平台兼容性
uni-app(4.82)
| Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
|---|---|---|---|---|---|---|---|---|
| × | × | × | × | × | × | 5.0 | 12 | 5.0.0 |
| 微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 小红书小程序 | 快应用-华为 | 快应用-联盟 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| × | × | × | × | × | × | × | × | × | × | × | × |
uni-app x(4.82)
| Chrome | Safari | Android | iOS | 鸿蒙 | 微信小程序 |
|---|---|---|---|---|---|
| × | × | 5.0 | 12 | 5.0.0 | × |
zf-aliplayerUTS
zf-aliplayerUTS 基于阿里云播放器 SDK 封装,支持 Android、iOS、HarmonyOS NEXT 的 URL 播放、VidAuth/VidSts 加密播放、视频倍速、清晰度列表、清晰度切换、截图和画中画。
组件
<zf-aliplayerUTS :style="{ width: '750rpx', height: '420px' }" />
License
阿里云播放器 SDK 需要按官方文档配置 License。
- Android:建议在宿主
AndroidManifest.xml配置com.aliyun.alivc_license.licensekey和com.aliyun.alivc_license.licensefile。 - Android:也可以调用
configureLicense,内部会走AlivcLicense.configLicense(context, licenseKey, licenseFile, callback)。 - iOS:可调用
configureLicense执行AliPrivateService.initLicenseService()初始化,License 文件仍按 Pod/工程配置接入。 - HarmonyOS NEXT:调用
configureLicense({ licenseKey })会走PrivateService.initService(context, licenseKey);premierlibrary.har仍需按官方方式随模块引入。
import { configureLicense } from '@/uni_modules/zf-aliplayerUTS'
configureLicense({
licenseKey: 'your-license-key',
licenseFile: '/path/to/license.crt'
})
URL 播放
import { startVideo } from '@/uni_modules/zf-aliplayerUTS'
startVideo({
sourceType: 'url',
url: 'https://example.com/video.mp4',
isAutoPlay: true,
scalingMode: 2
})
视频加密
- 标准 HLS AES-128 加密:直接使用
sourceType: 'url'播放 m3u8 地址。 - 阿里云私有加密 URL 播放:按阿里云播放器 SDK 约定,在播放 URL 中追加
etavirp_nuyila=1参数。 - 点播凭证播放:使用
sourceType: 'vidAuth'。 - STS 临时授权播放:使用
sourceType: 'vidSts'。
VidAuth 加密播放
startVideo({
sourceType: 'vidAuth',
vid: 'video-id',
playAuth: 'play-auth',
region: 'cn-shanghai',
isAutoPlay: true
})
VidSts 加密播放
startVideo({
sourceType: 'vidSts',
vid: 'video-id',
accessKeyId: 'access-key-id',
accessKeySecret: 'access-key-secret',
securityToken: 'security-token',
region: 'cn-shanghai'
})
事件监听
import { addDelegate, removeDelegate } from '@/uni_modules/zf-aliplayerUTS'
addDelegate({
success: (res) => {
console.log(res.evenType, res)
}
})
removeDelegate({})
常用事件:
onPreparedonRenderingViewonVideoProcessonBufferStartonBufferProgressonBufferEndonSeekCompleteonCompletiononErroronTrackChangedonShowPIPModeonClosePIPMode
倍速
import { setSpeed, getSpeed } from '@/uni_modules/zf-aliplayerUTS'
setSpeed(1.5)
console.log(getSpeed())
清晰度
import { getQualityList, selectQuality } from '@/uni_modules/zf-aliplayerUTS'
getQualityList({
success: (list) => {
console.log(list)
if (list.length > 0) {
selectQuality({ index: list[0].index })
}
}
})
播放控制
import {
start,
pause,
stopVideo,
seekTo,
setMute,
setVolume,
setAspectRatio,
getDuration,
getCurrentPosition,
getBufferPosition,
isPlaying,
isCompleted
} from '@/uni_modules/zf-aliplayerUTS'
start()
pause()
seekTo(30 * 1000)
setMute(false)
setVolume(80)
setAspectRatio(2)
console.log(getDuration(), getCurrentPosition(), getBufferPosition(), isPlaying(), isCompleted())
stopVideo({})
截图
import { takeSnapshot } from '@/uni_modules/zf-aliplayerUTS'
takeSnapshot({
success: (res) => {
console.log(res.base64)
}
})
画中画
import { startPIP, stopPIP } from '@/uni_modules/zf-aliplayerUTS'
startPIP()
stopPIP()

收藏人数:
购买普通授权版(
试用
赞赏(0)
下载 261
赞赏 0
下载 11833796
赞赏 1911
赞赏
京公网安备:11010802035340号