收藏
回答

live-player为什么切到后台仍有声音?

live-player组件,点击胶囊按钮退出或者上滑退出,小程序运行在后台,为什么还在播放声音呢?

接入的TRCT实时音视频,在onHide中写对live-plater的音频流静音但是无效,在返回小程序的时候才静音成功

<view v-for="(item,index) in TRTCDATA.playerList" :key="item.id">
  <live-player style="width: 100vw;height: 100vh;" class="player" :id="item.id" :data-userid="item.userID"
  :data-streamid="item.streamID" :data-streamtype="item.streamType" :src="item.src" mode="live" 
  autoplay="true" :mute-audio="item.muteAudio" :mute-video="item.muteVideo"
  orientation="vertical" min-cache="1" max-cache="2" sound-mode="speaker" @statechange="_playerStateChange"
  @fullscreenchange="_playerFullscreenChange" @netstatus="_playerNetStatus"
  @audiovolumenotify="_playerAudioVolumeNotify" />
</view>

onHide(() => {
  TRTCDATA.playerList = list = TRTCDATA.TRTCexample.setPlayerAttributes(TRTCDATA.playerList[0].id, {'muteAudio': true})
})
最后一次编辑于  2023-06-21
回答关注问题邀请回答
收藏

2 个回答

  • 社区技术运营专员--阳光
    社区技术运营专员--阳光
    2023-06-21

    你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

    2023-06-21
    有用
    回复 1
    • Ti Amo
      Ti Amo
      2023-06-21
      iphone13,微信8.0.38,代码写在问题中了,好像是因为onhide的时候页面view先跳转到其他页面,逻辑层执行代码的时候获取不到拉留对象,这样要如何处理呢
      2023-06-21
      回复
  • Mars
    Mars
    04-19

    我是在iOS测试,返回上一个页面后仍然有声音,onUnload里面已经把参数都重置了也不行,onUnload方法也执行了

    04-19
    有用
    回复
登录 后发表内容