阿里云Web RTS推流-记录

 

  1.  Web RTS推流SDK简介:WebRTS推流SDK是什么,对浏览器有什么要求_视频直播-阿里云帮助中心Web RTS推流SDK实现了更完善的推流能力,并支持本地混流功能,推荐您使用Web RTS推流SDK进行推流。icon-default.png?t=N7T8https://help.aliyun.com/zh/live/user-guide/overview-of-web-rts-sdk-for-stream-ingest?spm=a2c4g.11186623.0.0.22aeb67dY0ZdE7
  2. 文档:RtsClient | 阿里云RTS推流SDK - v1.2.1Documentation for 阿里云RTS推流SDK - v1.2.1icon-default.png?t=N7T8https://g.alicdn.com/apsara-media-box/imp-web-rts-pusher/1.2.1/docs/docs/classes/RtsClient.html
  3. demo: :https://github.com/aliyunvideo/AliyunPlayer_Webicon-default.png?t=N7T8https://github.com/aliyunvideo/AliyunPlayer_Web
  4. 自己写个demo用一下:
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <style>
            .videosty{
                width: 600px;
                height: 500px;
                background-color: #cccccc;
            }
        </style>
    </head>
    
    <!--<script src="js/jquery-1.12.4.js"></script>-->
    <script src="https://g.alicdn.com/apsara-media-box/imp-web-rts-pusher/1.2.1/aliyun-rts-pusher.js"></script>
    <body>
    <div class="videosty" id="videoContainer"></div>
    </body>
    <script>
        async function initClient (){
            // 创建推流实例
            const pushClient = AliRTSPusher.createClient();
            console.log(pushClient)
            // 监听错误事件
            pushClient.on('error', (err) => { console.log(err.errorCode) });
    
            //给预览画面指定一个 DOM 容器,SDK 将会在这个元素中生成 VIDEO 元素并播放预览画面
            const videoEl = pushClient.setRenderView('videoContainer');
            // 如果希望将本地预览静音(推出去的流不会静音)
            videoEl.muted = false;
    
            //设置推流视频质量
            pushClient.setVideoQuality('720p_1');
    
            // 打开摄像头  开启摄像头采集,捕获一个视频流
            await pushClient.startCamera();
    
            // 打开麦克风
            await pushClient.startMicrophone();
    
            //地址
            pushClient.startPush('artc://dizhi');
    
            //开始屏幕采集
            pushClient.startScreenCapture();
        };
    
        initClient();
    
        // pushClient.stopPush();
        // 关闭摄像头
        // pushClient.stopCamera();
        // 关闭麦克风
        // pushClient.stopMicrophone();
    
    </script>
    </html>
    
    
     效果:
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值