【问题标题】:Opentok React Native is not publishing anythingOpentok React Native 没有发布任何东西
【发布时间】:2019-02-23 22:02:10
【问题描述】:

我在我的应用程序中使用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】:

    这里是 TokBox 开发者宣传员。

    您似乎正在尝试通过单个道具监听事件。请注意,您需要使用 eventHandlers 属性来设置事件监听器。下面是如何为OTSession 组件设置事件监听器的示例:In Opentok-react-native, how do I get various events information like client connected, disconnected and so on

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

    我还建议查看 OpenTok-React-Native-Samples 存储库以供参考。

    【讨论】:

      猜你喜欢
      • 2017-07-20
      • 1970-01-01
      • 2017-10-08
      • 2022-09-30
      • 1970-01-01
      • 2021-05-21
      • 2015-01-03
      • 2020-12-19
      • 2019-03-21
      相关资源
      最近更新 更多