我正在尝试使用OpenTok React Native包将发布者的名称显示在视频流的顶部(发布者和订阅者端)。
根据OTPublisher component的文档,只需将name密钥作为属性之一传入即可。
我尝试将名称添加到属性并将其传递给OTPublisher组件,但它不会在发布者或订阅者上显示。我还需要做些别的事情吗?
下面是我正在使用的示例代码:
class App extends Component {
  constructor(props) {
    super(props);
    this.publisherProperties = {
      publishAudio: false,
      cameraPosition: 'front',
      name: 'Test Name'
    };
    this.publisherEventHandlers = {
      streamCreated: event => {
        console.log('Publisher stream created!', event);
      },
      streamDestroyed: event => {
        console.log('Publisher stream destroyed!', event);
      }
    };
  }
  render() {
    return (
      <OTSession apiKey="your-api-key" sessionId="your-session-id" token="your-session-token">
        <OTPublisher
          properties={this.publisherProperties}
          eventHandlers={this.publisherEventHandlers}
          style={{ height: 100, width: 100 }}
        />
      </OTSession>
    );
  }
}发布于 2019-01-26 02:11:02
这里是TokBox开发者的布道者。
OpenTok React本地库呈现由OpenTok iOS和Android提供支持的本机视图。这些移动端SDK不支持叠加name的视频渲染,目前只能使用OpenTok JS SDK。
如果您在web上订阅相同的会话(您可以使用OpenTok Playground tool对其进行测试),您将看到设置name属性是有效的。
https://stackoverflow.com/questions/54359575
复制相似问题