我正在使用 opentok-react-native 向我的应用程序添加视频通话功能,代码在虚拟 android 设备中运行良好,但是当我尝试在我的物理设备上运行应用程序时,我收到此错误 TypeError: null is not an object(评估'OT.setNativeEvents') 有人可以帮帮我吗。我的代码是
import React, {Component} from 'react';
import {View} from 'react-native';
import {OT, OTPublisher, OTSession, OTSubscriber} from "opentok-react-native";
export default class VideoCall extends Component {
constructor(props) {
super(props);
this.publisherProperties = {
publishAudio: false,
cameraPosition: 'front'
};
this.publisherEventHandlers = {
streamCreated: event => {
console.log('Publisher stream created!', event);
},
streamDestroyed: event => {
console.log('Publisher stream destroyed!', event);
}
};
}
render() {
return (
<OTSession apiKey="my api" sessionId="session id " token="token">
<OTPublisher
properties={this.publisherProperties}
eventHandlers={this.publisherEventHandlers}
style={{ height: 100, width: 100 }}
/>
</OTSession>
);
}
}