live-player中在onHide中操作直播实例不生效


<view class="page-body">

<view class="page-section tc">

<live-player id="player" src="{{liveSrc}}"

mode="live" bindstatechange="statechange" binderror="error" background-mute/>


<view class="btn-area">

<button bindtap="bindPlay" class="page-body-button" type="primary">播放</button>

<button bindtap="bindPause" class="page-body-button" type="primary">暂停</button>

<button bindtap="bindStop" class="page-body-button" type="primary">停止</button>

<button bindtap="bindResume" class="page-body-button" type="primary">恢复</button>

<button bindtap="bindMute" class="page-body-button" type="primary">静音</button>

<button bindtap="setSrc" class="page-body-button" type="primary">src</button>

</view>

</view>

</view>


/* eslint-disable */

const app = getApp()

Page({

    data: {

        liveSrc: "",

        state: 0, // 当前视频状态,0暂停,1播放,-1无视频或播放失败,用于控制页面上元素的展示

        fullScreen: false,

        mute: false,

        init: true // 是否是第一次播放,用于控制只进行一次play()

    },

    onLoad: function () {

        this.setData({

            // liveSrc:"http://tx.corp-flv.huya.com/huyalive/35754395-35754395-153563957213265920-3155517294-10057-A-1523883632-63059.flv?wsSecret=551b73f934a29fcc48ec24010c6a3a81&wsTime=5ad601ce"

            liveSrc:"rtmp://live.hkstv.hk.lxdns.com/live/hks"

        })

    },

    onReady(res) {

        this.ctx = wx.createLivePlayerContext('player')

    },

    /* 直播相关 start */

   

    // 静音按钮

    tapMute() {

        this.bindMute();

    },

 

展开全部
收起
3回答
提交回答
  • 至过去的我

    2044人对此回答表示赞同

    我是未来的你,你现在是不是在年找寻小程序答案。你不要感觉诧异,给你来信原因,就是让你不在后悔。今天去学习如何推广小程序,相信......点击查看更多>
    发布于
  • 林小姐也是lyn

    9人对此回答表示赞同

    现在有解决方案了吗

    展开
    9
    0回复
    发布于 6年前

    评论(0)

    收起评论

  • Mira

    5人对此回答表示赞同

    我也遇到这个问题,是因为onhide的时候页面view先跳转到其他页面,逻辑层执行代码的时候获取不到拉留对象,请问你现在解决了吗

    展开
    5
    0回复
    发布于 6年前

    评论(0)

    收起评论

  • Keyanna Lee

    2人对此回答表示赞同

    onHide的时候用this.ctx.stop()事件呢

    展开
    2
    1回复
    发布于 6年前

    评论(1)

    收起评论

    • Abigail 2018-12-22 21:53

      也没有效果,试过了

      回复
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
咨询热线

13312967497

扫码添加业务即可随时咨询 还可领取小程序推广攻略

业务咨询: 13312967497
扫码咨询

扫码咨询套餐

回到顶部