当前位置:网站首页>TRTC applet custom message

TRTC applet custom message

2022-06-24 06:12:00 sskingss

Currently on the applet side SEI news , Only receiving but not sending is supported

about native The message sent by the terminal , The applet side receives the data through 2012 Event code for , The relevant receiving codes are as follows

stay live-player There is an event binding on , And set up enable-recv-message The attribute is true The abbreviation here is as follows :

<live-player enable-recv-message="{{true}}" bindstatechange="_playerStateChange"></live-player>
_playerStateChange(event) {
  if(event.detail.code == 2012){
    console.log(' Custom message ', event.detail.message)
  }
}

Use trtc-wx When , You can do it by yourself _playerStateChange Add this logic to , Or through REMOTE_STATE_UPDATE This event monitors , Judge event.detail.code Is it 2012 To distinguish between .

原网站

版权声明
本文为[sskingss]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/07/20210726125754942F.html