txLive 模塊封裝了騰訊雲直播服務javascript
https://docs.apicloud.com/Cli...
通過試用,這個模塊堪稱最簡單最快速能使用起來的直播模塊。
界面上的按鈕,根據本身的須要,能夠顯示和隱藏。帶有各類美顏功能(美白、瘦臉、V形臉)。推流的碼率和清晰度能夠設置。css
使用流程:html
推流界面截圖:java
<!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>
複製代碼api