我如何获得 Aspara Video 播放授权?
How do I get an Aspara Video playauth?
我正在尝试使用 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>
这让我可以使用 'play stream URL' 功能播放视频。但是,这似乎无法启用字幕和分辨率选择器等功能,这就是我使用 Aspara 的全部原因。根据我在文档中阅读的内容,这需要 'Playauth' id.
您可以使用API或SDK获取playauth ID。
让我强调一下如何使用 API 获取 playauth ID:
请求示例:
http://vod.cn-shanghai.aliyuncs.com/?Action=GetVideoPlayAuth&VideoId=1234&Format=JSON
回复:
{
"RequestId": "123456",
"VideoMeta": {
"VideoId": "98756",
"Title": "Alibaba Cloud VOD",
"Status": "Normal"
},
"PlayAuth": "sstyYuew678999ew90000000xtt7TYUh"
}
我正在尝试使用 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>
这让我可以使用 'play stream URL' 功能播放视频。但是,这似乎无法启用字幕和分辨率选择器等功能,这就是我使用 Aspara 的全部原因。根据我在文档中阅读的内容,这需要 'Playauth' id.
您可以使用API或SDK获取playauth ID。
让我强调一下如何使用 API 获取 playauth ID:
请求示例:
http://vod.cn-shanghai.aliyuncs.com/?Action=GetVideoPlayAuth&VideoId=1234&Format=JSON
回复:
{
"RequestId": "123456",
"VideoMeta": {
"VideoId": "98756",
"Title": "Alibaba Cloud VOD",
"Status": "Normal"
},
"PlayAuth": "sstyYuew678999ew90000000xtt7TYUh"
}