我正在尝试使用 Aspara Video 在中国分发视频。我已经将视频上传到阿里云,并得到了下面的标准 HTML 代码。
<head>
<meta charset="UTF-8">
<meta http-equiv="x-ua-compatible" content="IE=edge" >
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"/>
<title>Vod</title>
<link rel="stylesheet" href="//g.alicdn.com/de/prismplayer/2.6.0/skins/default/aliplayer-min.css" />
<script type="text/javascript" src="//g.alicdn.com/de/prismplayer/2.6.0/aliplayer-min.js"></script>
</head>
<body>
<div class="prism-player" id="J_prismPlayer"></div>
<script>
var player = new Aliplayer({
id: "J_prismPlayer",
autoplay: true,
width:"1920px",
height:"1280px",
vid:"<--video-id-->",
playauth:'',
cover:''
});
</script>
</body>
为了使 HTML 代码正常工作,需要有一个“playauth”代码。我不确定在哪里可以找到此代码,也无法在阿里巴巴帮助网站上找到任何指导。
更新 - 阿里巴巴支持告诉我改为使用此代码为 Prismplayer:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"/>
<title>User test case</title>
<link rel="stylesheet" href="//g.alicdn.com/de/prismplayer/2.7.1/skins/default/aliplayer-min.css" />
<script type="text/javascript" src="//g.alicdn.com/de/prismplayer/2.7.1/aliplayer-min.js"></script>
</head>
<body>
<div class="prism-player" id="J_prismPlayer" style="position: absolute"></div>
<script>
var player = new Aliplayer({
id: 'J_prismPlayer',
width: '100%',
autoplay: false,
//Supports playing based on a stream playback address, which has the highest priority.
source: 'stream play URL',
//Playback method 2: recommended for VOD users
vid : '1e067a2831b641db90d570b6480fbc40',
playauth : '',
cover: 'http://liveroom-img.oss-cn-qingdao.aliyuncs.com/logo.png',
//Playback method 3: only applicable to MPS users
vid : '1e067a2831b641db90d570b6480fbc40',
accId: '',
accSecret: '',
stsToken: '',
domainRegion: '',
authInfo: '',
//Playback method 4: based on STS
vid : '1e067a2831b641db90d570b6480fbc40',
accessKeyId: '',
securityToken: '',
accessKeySecret: ''
},function(player){
console.log('The player has been created.')
});
</script>
</body>
</html>
这使我可以使用“播放流 URL”功能播放视频。但是,这似乎无法启用字幕和分辨率选择器等功能,这就是我使用 Aspara 的全部原因。根据我在文档中阅读的内容,这需要“Playauth”ID。