本文出自APICloud官方论坛,

感谢论坛版uoaccw分享。

txLive 模块封装了腾讯云直播服务

https://docs.apicloud.com/Client-API/Open-SDK/txLive
经过试用,这个模块堪称最简单最快速能使用起来的直播模块。
界面上的按钮,根据自己的需要,可以显示和隐藏。带有各种美颜功能(美白、瘦脸、V形脸)。推流的码率和清晰度可以设置。

使用流程:
1. 注册腾讯云平台
2. 进行实名认证
3. 开通直播服务
4. 生成推流地址(https://cloud.tencent.com/document/product/454/14551#URL

代码:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
<title>title</title>
<link rel="stylesheet" type="text/css" href="../css/api.css" />
<style>
body {
padding-top: 160px;
height: 1000px;
}
.content {
margin-top: 350px;
}
button {
margin: 10px;
}
</style>
</head>
<body>
<div class="content">
<button tapmode type="button" onclick="openPusher()" name="button">openPusher</button>
<button tapmode type="button" onclick="openPlayer()" name="button">openPlayer</button>
<button tapmode type="button" onclick="setLiveBtnsVisibility()" name="button">setLiveBtnsVisibility</button>
</div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript">
apiready = function() {
};
function openPusher() {
var txLive = api.require('txLive');
txLive.openPusher({
x: 0,
y: 50,
h: 350,
w: api.winWidth,
fixedOn: api.frameName,
fixed: false,
url: "" //填写腾讯云平台上生成的推流地址
});
}
//播放接口,播放端使用
function openPlayer() {
var txLive = api.require('txLive');
txLive.openPlayer({
x: 0,
y: 0,
url: "" //填写腾讯云平台上生成的播放地址
});
}
function setLiveBtnsVisibility() {
var txLive = api.require('txLive');
txLive.setLiveBtnsVisibility({
"btnid": "btnLog",
"show": 0
});
}
</script>
</html>
复制代码

最新文章

  1. Java实现不同的WebService 调用方式
  2. 基本排序(二)插入排序(直接插入、Shell、折半)
  3. 轻量级Image Library
  4. android 修改framework下资源文件后如何编译
  5. iOS - Xcode 配置
  6. C#异步将文本内容写入文件
  7. Universal Serial Bus USB 3.0
  8. Nancy 简单学习
  9. VC++ 网络编程总结(二)
  10. HW--自守数
  11. struct--------构造函数对结构体初始化的影响
  12. DataTables 配置和使用
  13. css阴影--box-shadow的用法
  14. Matrix (二维树状数组)
  15. Chrome 开发者工具的使用
  16. POI读取excel工具类 返回实体bean集合(xls,xlsx通用)
  17. java中方法调用
  18. C 实现可变参数
  19. Github上的Android项目介绍之ListViewAnimation(针对listView item的侧滑菜单)(1)
  20. Flume+Kafka+Storm+Hbase+HDSF+Poi整合

热门文章

  1. Codeforces Round #180 (Div. 1 + Div. 2)
  2. java一维数组的声明与初始化
  3. JavaScript:4个常见的内存泄露
  4. Python--day40--threading模块的几个方法
  5. P1106 细胞分裂
  6. 21个项目玩转深度学习:基于TensorFlow的实践详解06—人脸检测和识别——项目集锦
  7. H3C 路由环路
  8. I/O 端口和 I/O 内存
  9. Leecoder466 Count The Repetitons
  10. Spring Security 学习笔记-securityContext过滤器过滤链学习