1、根据视频地址播放
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<link rel="stylesheet" href="https://g.alicdn.com/de/prismplayer/2.8.1/skins/default/aliplayer-min.css" />
<script charset="utf-8" type="text/javascript" src="https://g.alicdn.com/de/prismplayer/2.8.1/aliplayer-min.js"></script>
<div class="prism-player" id="J_prismPlayer"></div>
<script>
var player = new Aliplayer({
id: 'J_prismPlayer',
width: '100%',
autoplay: false,
cover: 'http://liveroom-img.oss-cn-qingdao.aliyuncs.com/logo.png',
//播放配置
source : 'https://outin-330daf7945c511eab0c600163e1c35d5.oss-cn-shanghai.aliyuncs.com/sv/20bd2acc-1730b0b8921/20bd2acc-1730b0b8921.mp4?Expires=1594019827&OSSAccessKeyId=LTAI3DkxtsbUyNYV&Signature=IaW3gDBLw%2Fk0%2FHHf4lVyu2Fu8YU%3D',
},function(player){
console.log('播放器创建好了。')
});
</script>
</body>
</htm
l>
2 根据播放凭证播放
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<link rel="stylesheet" href="https://g.alicdn.com/de/prismplayer/2.8.1/skins/default/aliplayer-min.css" />
<script charset="utf-8" type="text/javascript" src="https://g.alicdn.com/de/prismplayer/2.8.1/aliplayer-min.js"></script>
<div class="prism-player" id="J_prismPlayer"></div>
<script>
var player = new Aliplayer({
id: 'J_prismPlayer',
width: '100%',
autoplay: false,
cover: 'http://liveroom-img.oss-cn-qingdao.aliyuncs.com/logo.png',
//播放配置
encryptType: '1',//如果播放加密视频,则需设置encryptType=1,非加密视频无需设置此项
vid: '52d80ae859244bdc8275fce9a6a3ee52',
playauth: 'eyJTZWN1cml0eVRva2VuIjoiQ0FJUzN3SjFxNkZ0NU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凭证有过期时间,默认值:100秒 。取值范围:100~3000。
//request.setAuthInfoTimeout(200L);