Skip to content

Commit

Permalink
Update example
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshLipan committed Nov 9, 2018
1 parent 355a66c commit 795adc9
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new JMessageReactPackage(true),
new JMRTCReactPackage(true)
new JMRTCReactPackage(true,false)

);
}
Expand Down
69 changes: 20 additions & 49 deletions example/app/RTCComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,13 @@ export default class RTCComponent extends Component {

// JMRTCViewController.addCallConnectingListener(callback)

// JMRTCViewController.addCallConnectedListener(callback)
JMRTCViewController.addCallConnectedListener(() =>{
JMRTCViewController.setVideoView({ username: "0001" });
})

// JMRTCViewController.addCallMemberJoinListener(callback)
JMRTCViewController.addCallMemberJoinListener(() => {
JMRTCViewController.setVideoView({ username: "0002" });
});

// JMRTCViewController.addCallDisconnectListener(callback)

Expand Down Expand Up @@ -127,54 +131,21 @@ export default class RTCComponent extends Component {
<FormButton
title="视频"
onPress={ () => {
if (Platform.OS === "android") {
// JMRTCViewController.reinitEngine(
// res => {
// console.log(`engine init success ${JSON.stringify(res)}`);
JMRTCViewController.startCallUsers(
{ usernames: [this.state.username], type: "video" },
res => {
JMRTCViewController.setVideoView({ username: "0001" });
JMRTCViewController.setVideoView({ username: "0002" });
console.log("targetUsername" + this.props.myUsername);
this.setState({
targetUsername: this.state.username,
isCalling: true
});
},
err => {
console.log(`startCallUsers fail ${JSON.stringify(err)}`);
}
);
// },
// err => {
// console.log("engine init fail");
// }
// );
}else{
JMRTCViewController.initEngine(res => {
console.log(`engine init success ${JSON.stringify(res)}`);
JMRTCViewController.startCallUsers({ usernames: [this.state.username], type: "video" }, res => {
JMRTCViewController.setVideoView(
{ username: "0001" }
);
JMRTCViewController.setVideoView(
{ username: "0002" }
);
console.log("targetUsername" + this.props.myUsername);
this.setState({
targetUsername: this
.state.username,
isCalling: true
});
}, err => {
console.log(`startCallUsers fail ${JSON.stringify(err)}`);
});
}, err => {
console.log("engine init fail");
});
JMRTCViewController.startCallUsers(
{ usernames: [this.state.username], type: "video" },
res => {
JMRTCViewController.setVideoView({ username: "0001" });
JMRTCViewController.setVideoView({ username: "0002" });
console.log("targetUsername" + this.props.myUsername);
this.setState({
targetUsername: this.state.username,
isCalling: true
});
},
err => {
console.log(`startCallUsers fail ${JSON.stringify(err)}`);
}

);

} }
/>
Expand Down
2 changes: 1 addition & 1 deletion example/app/RTCVideoView.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default class RTCVideoView extends Component {
},1000)
return (
<Modal
animationType="slide"
animationType={"slide"}
transparent={true}
visible={this.props.visible}>
<JMRTCView style={styles.callAlertContainer}
Expand Down
14 changes: 7 additions & 7 deletions example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"test": "jest"
},
"dependencies": {
"jcore-react-native": "^1.2.9",
"jmessage-react-plugin": "^2.4.4",
"jcore-react-native": "^1.2.11",
"jmessage-react-plugin": "^2.4.8",
"jmrtc-react-native": "^1.0.1",
"react": "16.4.1",
"react-native": "^0.54.0"
Expand Down

0 comments on commit 795adc9

Please sign in to comment.