Opentok React Native不发布任何内容

问题描述 投票:0回答:1

我在我的应用程序中使用opentok-react-native库,我想发布音频和视频流作为音频/视频通话。我按照文档写了这封信,但我无法连接。

这是我尝试过的:

render() {

return (

    <OTSession
          apiKey={ this.state.api_key }
          sessionId={ this.state.appointment.opentok_session }
          token={ this.state.appointment.opentok_token }
          connectionCreated={ console.warn('connected') }
          connectionDestroyed={ console.warn('destroyed') }
          sessionConnected={ console.warn('session connected') }
          sessionReconnecting={ console.warn('session reconnecting') }
          sessionReconnected={ console.warn('session re connected') }
          sessionDisconnected={ console.warn('session destroyed') }
          streamCreated={ console.warn('stream created') }
          streamDestroyed={ console.warn('stream destroyed') }
        >
          <OTPublisher
            properties={{ publishAudio: true, publishVideo: true }}
            style={{ height: 100, width: 100 }}
          />
          <OTSubscriber  style={{ flex: 1 }} />
        </OTSession>

    )

}

我在其他应用程序中编写了完全相同的组件 - 有两个应用程序。一旦组件加载,我得到所有的console.warn(),但没有别的。

reactjs react-native opentok tokbox
1个回答
0
投票

TokBox Developer Evangelist在这里。

看起来你正试图通过个别道具来听取事件。请注意,您需要使用eventHandlers prop来设置事件监听器。以下是如何为OTSession组件设置事件侦听器的示例:In Opentok-react-native, how do I get various events information like client connected, disconnected and so on

您还需要为width组件指定heightOTSubscriber,以便库知道创建本机视图的大小。

我还建议您查看OpenTok-React-Native-Samples回购以供参考。

© www.soinside.com 2019 - 2024. All rights reserved.