阿里云视频播放器整合与学习

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: '52d80ae859244bdc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
        }, function (player) {
            console.log('播放器创建好了。')
        });
    </script>

</body>

</html>

3、视频播放凭证有时效,默认时长100秒

java 复制代码
//播放凭证有过期时间,默认值:100秒 。取值范围:100~3000。
//request.setAuthInfoTimeout(200L);
相关推荐
码蜂窝编程官方2 分钟前
【含开题报告+文档+PPT+源码】基于SpringBoot+Vue的虎鲸旅游攻略网的设计与实现
java·vue.js·spring boot·后端·spring·旅游
Viktor_Ye18 分钟前
高效集成易快报与金蝶应付单的方案
java·前端·数据库
hummhumm20 分钟前
第 25 章 - Golang 项目结构
java·开发语言·前端·后端·python·elasticsearch·golang
一二小选手24 分钟前
【Maven】IDEA创建Maven项目 Maven配置
java·maven
J老熊30 分钟前
JavaFX:简介、使用场景、常见问题及对比其他框架分析
java·开发语言·后端·面试·系统架构·软件工程
猿java35 分钟前
什么是 Hystrix?它的工作原理是什么?
java·微服务·面试
AuroraI'ncoding36 分钟前
时间请求参数、响应
java·后端·spring
好奇的菜鸟1 小时前
Go语言中的引用类型:指针与传递机制
开发语言·后端·golang
所待.3831 小时前
JavaEE之线程初阶(上)
java·java-ee
Winston Wood1 小时前
Java线程池详解
java·线程池·多线程·性能