Ser*_*MAN 6 javascript reactjs jitsi react-native jitsi-meet
我是 React-native 和 Jitsi-Meet 的新手。\n我尝试使用 Jitsi Meet 开发一个视频通话应用程序。\n我按照官方网站上的描述应用了所有内容,但出现了图片中的错误。
\n\n这是我的一些代码
\n在我的 Jitsi.js 组件上=
\nimport React from \'react\';\nimport { View } from \'react-native\';\nimport JitsiMeet, { JitsiMeetView } from \'react-native-jitsi-meet\';\n\nclass VideoCall extends React.Component {\n constructor(props) {\n super(props);\n this.onConferenceTerminated = this.onConferenceTerminated.bind(this);\n this.onConferenceJoined = this.onConferenceJoined.bind(this);\n this.onConferenceWillJoin = this.onConferenceWillJoin.bind(this);\n }\n\n\n componentDidMount() {\n console.log(props);\n\n const { username, roomname } = this.props;\n\n setTimeout(() => {\n const url = `https://your.jitsi.server/${roomname}`; // can also be only room name and will connect to jitsi meet servers\n const userInfo = { \n displayName: `${username}`, \n email: \'user@example.com\', \n avatar: \'https:/gravatar.com/avatar/abc123\' };\n JitsiMeet.call(url, userInfo);\n /* You can also use JitsiMeet.audioCall(url) for audio only call */\n /* You can programmatically end the call with JitsiMeet.endCall() */\n }, 1000);\n }\n\n onConferenceTerminated(nativeEvent) {\n /* Conference terminated event */\n }\n\n onConferenceJoined(nativeEvent) {\n /* Conference joined event */\n }\n\n onConferenceWillJoin(nativeEvent) {\n /* Conference will join event */\n }\n\n render() {\n return (\n <View style={{ backgroundColor: \'black\',flex: 1 }}>\n <JitsiMeetView onConferenceTerminated={this.onConferenceTerminated} onConferenceJoined={this.onConferenceJoined} onConferenceWillJoin={this.onConferenceWillJoin} style={{ flex: 1, height: \'100%\', width: \'100%\' }} />\n </View>\n );\n }\n}\n\nexport default VideoCall;Run Code Online (Sandbox Code Playgroud)\r\n在我的 App.Js 上导入 jitsi 组件 =
\nimport React, {useState} from \'react\';\nimport { Platform, StyleSheet, Text, View, Button, TextInput } from \'react-native\';\nimport JitsiMeet from \'./components/jitsi\'\nconst instructions = Platform.select({\n ios: `\xc5\x9eu anda IOS konfig\xc3\xbcrasyon`,\n android: `Android Konfig\xc3\xbcrasyon`,\n});\n\nexport default function App() {\n const [Count, setCount] = useState(0);\n const [value, SetValue] = React.useState(\'\');\n const [value2, SetValue2] = React.useState(\'\');\n\n const addJitsi = () => {\n try {\n if (value !== \'\' && value2 !== \'\' ) {\n const roomname = value.replace(/ |,|\\.|/g, "");\n const username = value2.replace(/ |,|\\.|/g, "");\n return <JitsiMeet roomname={roomname} username={username}/>\n }\n return <Text style={styles.welcome}>L\xc3\xbctfen alanlar\xc4\xb1 doldurunuz</Text>\n } catch (error) {\n console.log(error);\n }\n }\n\n return (\n <View style={styles.container}>\n <View style={styles.header}>\n <Text style={styles.welcome}>Deep Lab University</Text>\n <TextInput\n style={styles.TextInputStyle}\n onChangeText={text => SetValue(text)}\n value={value}\n placeholder=\'Kanal ad\xc4\xb1: \'\n />\n <TextInput\n style={styles.TextInputStyle}\n onChangeText={text => SetValue2(text)}\n value={value2}\n placeholder=\'Kullan\xc4\xb1c\xc4\xb1 ad\xc4\xb1: \'\n />\n <Button title={\'Kanal Olu\xc5\x9ftur\'} style={{ marginBottom: \'3%\' }} onPress={(e) => console.log(value, value2)}/>\n </View>\n <Text style={styles.welcome}>Say\xc4\xb1m\xc4\xb1z: `${Count}`</Text>\n <Text style={styles.instructions}>To get started, edit App.js</Text>\n <Text style={styles.instructions}>{instructions}</Text>\n <Button title={`${Count}`} onPress={(e) => setCount(prevstate => prevstate +1)}/>\n {\n addJitsi()\n }\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n justifyContent: \'center\',\n alignItems: \'center\',\n backgroundColor: \'#F5FCFF\',\n },\n header: {\n backgroundColor: \'#999\',\n color: \'red\',\n minHeight: \'50%\',\n width: \'90%\',\n top: \'1%\',\n marginTop: \'0%\',\n \n },\n welcome: {\n fontSize: 20,\n textAlign: \'center\',\n margin: 10,\n },\n instructions: {\n textAlign: \'center\',\n color: \'#333333\',\n marginBottom: 5,\n },\n TextInputStyle: {\n height: 40, \n borderColor: \'gray\', \n borderWidth: 1,\n backgroundColor: \'white\',\n margin: \'2%\',\n }\n});\nRun Code Online (Sandbox Code Playgroud)\n我无法更进一步。提前致谢
\n| 归档时间: |
|
| 查看次数: |
1761 次 |
| 最近记录: |