前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >TRTC小程序本地关闭音视频,为什么远端收到了退房通知

TRTC小程序本地关闭音视频,为什么远端收到了退房通知

原创
作者头像
sskingss
发布2021-07-13 16:14:56
5830
发布2021-07-13 16:14:56
举报
文章被收录于专栏:学习之路学习之路

TRTC小程序会自动进行切换身份,如果本地没有音视频的上行,会自动切换成观众的身份(毕竟在大房间中不可能去维护一个几万人的userList,小程序里面做个循环都费劲)

那么在这个背景下,如果是有严格区分主播场景的该怎么办呢,

保持enable-mic为true,通过muted属性来设置禁音,这样后台不会改变主播位,远端也不会收到退房通知

代码语言:javascript
复制
this.setData({
  pusher: this.setPusherAttributes({muted: true})
})
live-pusher属性
live-pusher属性

要将这个属性绑定到live-pusher上

代码语言:javascript
复制
//page.wxml
<live-pusher
  class="pusher"
  url="{{pusher.url}}"
  mode="{{pusher.mode}}"
  autopush="{{pusher.autopush}}"
  enable-camera="{{pusher.enableCamera}}"
  enable-mic="{{pusher.enableMic}}"
  muted="{{!pusher.muted}}" // 这里要分别进行控制
  enable-agc="{{pusher.enableAgc}}"
  enable-ans="{{pusher.enableAns}}"
  enable-ear-monitor="{{pusher.enableEarMonitor}}"
  auto-focus="{{pusher.enableAutoFocus}}"
  zoom="{{pusher.enableZoom}}"
  min-bitrate="{{pusher.minBitrate}}"
  max-bitrate="{{pusher.maxBitrate}}"
  video-width="{{pusher.videoWidth}}"
  video-height="{{pusher.videoHeight}}"
  beauty="{{pusher.beautyLevel}}"
  whiteness="{{pusher.whitenessLevel}}"
  orientation="{{pusher.videoOrientation}}"
  aspect="{{pusher.videoAspect}}"
  device-position="{{pusher.frontCamera}}"
  remote-mirror="{{pusher.enableRemoteMirror}}"
  local-mirror="{{pusher.localMirror}}"
  background-mute="{{pusher.enableBackgroundMute}}"
  audio-quality="{{pusher.audioQuality}}"
  audio-volume-type="{{pusher.audioVolumeType}}"
  audio-reverb-type="{{pusher.audioReverbType}}"
  waiting-image="{{pusher.waitingImage}}"
  beauty-style="{{pusher.beautyStyle}}"
  filter="{{pusher.filter}}"
  bindstatechange="_pusherStateChangeHandler"
  bindnetstatus="_pusherNetStatusHandler"
  binderror="_pusherErrorHandler"
  bindbgmstart="_pusherBGMStartHandler"
  bindbgmprogress="_pusherBGMProgressHandler"
  bindbgmcomplete="_pusherBGMCompleteHandler"
  bindaudiovolumenotify="_pusherAudioVolumeNotify"
  />

主播的enable-mic的控制可以一直为true,然后通过muted控制是否上行,观众的enableMic和enableCamera可以一直未false

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 要将这个属性绑定到live-pusher上
相关产品与服务
云开发 CloudBase
云开发(Tencent CloudBase,TCB)是腾讯云提供的云原生一体化开发环境和工具平台,为200万+企业和开发者提供高可用、自动弹性扩缩的后端云服务,可用于云端一体化开发多种端应用(小程序、公众号、Web 应用等),避免了应用开发过程中繁琐的服务器搭建及运维,开发者可以专注于业务逻辑的实现,开发门槛更低,效率更高。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档