zoukankan      html  css  js  c++  java
  • 小程序rtmp监控视频播放

    //wxml
    <view class="wrap">
     <live-player id="live-player-id"   class='{{winstyle}}' src="rtmp://" mode="live/RTC" autoplay bindstatechange="playerstatechange" binderror="error">
        <cover-view class='full_img_idv' bindtap="fullScreen">
        <!-- 缩小--> <cover-view wx:if="{{fullScreenFlag}}"> <cover-image src="../../images/close.png" class='full_img' /> </cover-view>
        <!-- 放大 --> <cover-view wx:else> <cover-image src="../../images/ischeck.png" class='full_img' /> </cover-view> </cover-view> </live-player> </view> //js const app=getApp() Page({ data: { fullScreenFlag: false, }, onReady(res) { this.ctx = wx.createLivePlayerContext('live-player-id') }, onLoad:function(){ }, //放大缩小 fullScreen: function () { var fullScreenFlag = this.data.fullScreenFlag; if (fullScreenFlag) { fullScreenFlag = false; } else { fullScreenFlag = true; } if (fullScreenFlag) { this.ctx.requestFullScreen() this.setData({ fullScreenFlag: fullScreenFlag }) } else { this.ctx.exitFullScreen() this.setData({ fullScreenFlag: fullScreenFlag }) } }, //live-player返回状态码 playerstatechange(e) { console.log('live-player code:', e.detail.code) }, error(e) { console.error('live-player error:', e.detail.errMsg) }, }) //wxss live-player { 100%; height: 225px; position: relative; } live-pusher{ 100%; height: 225px; } .full_img_idv{ position: absolute; right: 30rpx; bottom: 30rpx; } .full_img { 40rpx; height: 40rpx; } .page-body-button { margin-bottom: 30rpx; }
  • 相关阅读:
    inflate, findViewById与setContentView的差别与联系
    Android_程序未处理异常的捕获与处理
    八皇后问题
    兔子--改动Android Studio的快捷键,改动成eclipse的快捷键
    关于cocos2d-x 和安卓之间的相互调用
    《JavaScript》——DOM
    *Android 多线程下载 仿下载助手
    (LeetCode)两个链表的第一个公共节点
    MVC初了解
    URL编码总结
  • 原文地址:https://www.cnblogs.com/minghan/p/13330939.html
Copyright © 2011-2022 走看看