txLive module (broadcast class) trial Share

This article comes from APICloud official forum,
thanks to the forum moderators uoaccw share.

txLive module encapsulates the live broadcast Tencent cloud service
https://docs.apicloud.com/Client-API/Open-SDK/txLive
after the test, the module can be called the easiest and quickest to use live module.
Button on the interface according to your needs, you can show and hide. Beauty with various functions (whitening, face-lift, V-shaped face). Plug flow rate and clarity may be provided.

manual:

  1. Sign Tencent cloud platform
  2. Real-name authentication
  3. Live service launched
  4. Plug flow generated address ( 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: to false,
            URL: "" // fill plug flow generated address Tencent cloud platform
        });
    }
// Play interfaces, playback end use
    function OpenPlayer () {
        var txLive api.require = ( 'txLive');
        txLive.openPlayer ({
            X: 0,
            Y: 0,
            URL: "" // fill playing address generated Tencent cloud platform
        });
    }
    function setLiveBtnsVisibility () {
        var txLive = api.require ( ' txLive ');
        txLive.setLiveBtnsVisibility ({
            "btnid": "btnLog",
            "Show": 0
        });
    }
</ Script>
</ HTML>
Copy the code `

Guess you like

Origin blog.51cto.com/9334358/2438358