How to use the react-native-agora.RtcEngine.on function in react-native-agora

To help you get started, we’ve selected a few react-native-agora examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github syanbo / react-native-agora / samples / simpleDemo / components / agora.js View on Github external
console.log('[RtcEngine] onUserOffline', data);
      this.setState({
          peerIds: this.state.peerIds.filter(uid => uid !== data.uid)
      })
    });
    RtcEngine.on('joinChannelSuccess', (data) => {
      console.log('[RtcEngine] onJoinChannelSuccess', data);
      RtcEngine.startPreview();
      this.setState({
        joinSucceed: true
      })
    });
    RtcEngine.on('audioVolumeIndication', (data) => {
      console.log('[RtcEngine] onAudioVolumeIndication', data);
    });
    RtcEngine.on('clientRoleChanged', (data) => {
      console.log("[RtcEngine] onClientRoleChanged", data);
    })
    RtcEngine.on('error', (data) => {
      if (data.error === 17) {
        RtcEngine.leaveChannel().then(_ => {
          RtcEngine.destroy();
          this.props.onCancel(data);
        });
      }
    })
    console.log("[CONFIG]", JSON.stringify(config));
    console.log("[CONFIG.encoderConfig", config.videoEncoderConfig);
    RtcEngine.init(config);
  }
github syanbo / react-native-agora / samples / simpleDemo / components / agora.js View on Github external
}
    });
    RtcEngine.on('userOffline', (data) => {
      console.log('[RtcEngine] onUserOffline', data);
      this.setState({
          peerIds: this.state.peerIds.filter(uid => uid !== data.uid)
      })
    });
    RtcEngine.on('joinChannelSuccess', (data) => {
      console.log('[RtcEngine] onJoinChannelSuccess', data);
      RtcEngine.startPreview();
      this.setState({
        joinSucceed: true
      })
    });
    RtcEngine.on('audioVolumeIndication', (data) => {
      console.log('[RtcEngine] onAudioVolumeIndication', data);
    });
    RtcEngine.on('clientRoleChanged', (data) => {
      console.log("[RtcEngine] onClientRoleChanged", data);
    })
    RtcEngine.on('error', (data) => {
      if (data.error === 17) {
        RtcEngine.leaveChannel().then(_ => {
          RtcEngine.destroy();
          this.props.onCancel(data);
        });
      }
    })
    console.log("[CONFIG]", JSON.stringify(config));
    console.log("[CONFIG.encoderConfig", config.videoEncoderConfig);
    RtcEngine.init(config);
github syanbo / react-native-agora / samples / simpleDemo / components / agora.js View on Github external
})
    });
    RtcEngine.on('joinChannelSuccess', (data) => {
      console.log('[RtcEngine] onJoinChannelSuccess', data);
      RtcEngine.startPreview();
      this.setState({
        joinSucceed: true
      })
    });
    RtcEngine.on('audioVolumeIndication', (data) => {
      console.log('[RtcEngine] onAudioVolumeIndication', data);
    });
    RtcEngine.on('clientRoleChanged', (data) => {
      console.log("[RtcEngine] onClientRoleChanged", data);
    })
    RtcEngine.on('error', (data) => {
      if (data.error === 17) {
        RtcEngine.leaveChannel().then(_ => {
          RtcEngine.destroy();
          this.props.onCancel(data);
        });
      }
    })
    console.log("[CONFIG]", JSON.stringify(config));
    console.log("[CONFIG.encoderConfig", config.videoEncoderConfig);
    RtcEngine.init(config);
  }
github syanbo / react-native-agora / samples / simpleDemo / components / agora.js View on Github external
clientRole: this.props.clientRole,
      videoEncoderConfig: {
        width: 360,
        height: 480,
        bitrate: 1,
        frameRate: FPS30,
        orientationMode: FixedLandscape,
      },
      clientRole: Host,
      audioProfile: AudioProfileDefault,
      audioScenario: AudioScenarioDefault
    };
    RtcEngine.on('firstRemoteVideoDecoded', (data) => {
      console.log('[RtcEngine] onFirstRemoteVideoDecoded', data);
    });
    RtcEngine.on('userJoined', (data) => {
      console.log('[RtcEngine] onUserJoined', data);
      const {peerIds} = this.state;
      if (peerIds.indexOf(data.uid) === -1) {
        this.setState({
          peerIds: [...peerIds, data.uid]
        })
      }
    });
    RtcEngine.on('userOffline', (data) => {
      console.log('[RtcEngine] onUserOffline', data);
      this.setState({
          peerIds: this.state.peerIds.filter(uid => uid !== data.uid)
      })
    });
    RtcEngine.on('joinChannelSuccess', (data) => {
      console.log('[RtcEngine] onJoinChannelSuccess', data);
github syanbo / react-native-agora / samples / simpleDemo / components / agora.js View on Github external
RtcEngine.on('userJoined', (data) => {
      console.log('[RtcEngine] onUserJoined', data);
      const {peerIds} = this.state;
      if (peerIds.indexOf(data.uid) === -1) {
        this.setState({
          peerIds: [...peerIds, data.uid]
        })
      }
    });
    RtcEngine.on('userOffline', (data) => {
      console.log('[RtcEngine] onUserOffline', data);
      this.setState({
          peerIds: this.state.peerIds.filter(uid => uid !== data.uid)
      })
    });
    RtcEngine.on('joinChannelSuccess', (data) => {
      console.log('[RtcEngine] onJoinChannelSuccess', data);
      RtcEngine.startPreview();
      this.setState({
        joinSucceed: true
      })
    });
    RtcEngine.on('audioVolumeIndication', (data) => {
      console.log('[RtcEngine] onAudioVolumeIndication', data);
    });
    RtcEngine.on('clientRoleChanged', (data) => {
      console.log("[RtcEngine] onClientRoleChanged", data);
    })
    RtcEngine.on('error', (data) => {
      if (data.error === 17) {
        RtcEngine.leaveChannel().then(_ => {
          RtcEngine.destroy();
github syanbo / react-native-agora / samples / simpleDemo / components / agora.js View on Github external
appid: APPID,
      channelProfile: this.props.channelProfile,
      videoProfile: this.props.videoProfile,
      clientRole: this.props.clientRole,
      videoEncoderConfig: {
        width: 360,
        height: 480,
        bitrate: 1,
        frameRate: FPS30,
        orientationMode: FixedLandscape,
      },
      clientRole: Host,
      audioProfile: AudioProfileDefault,
      audioScenario: AudioScenarioDefault
    };
    RtcEngine.on('firstRemoteVideoDecoded', (data) => {
      console.log('[RtcEngine] onFirstRemoteVideoDecoded', data);
    });
    RtcEngine.on('userJoined', (data) => {
      console.log('[RtcEngine] onUserJoined', data);
      const {peerIds} = this.state;
      if (peerIds.indexOf(data.uid) === -1) {
        this.setState({
          peerIds: [...peerIds, data.uid]
        })
      }
    });
    RtcEngine.on('userOffline', (data) => {
      console.log('[RtcEngine] onUserOffline', data);
      this.setState({
          peerIds: this.state.peerIds.filter(uid => uid !== data.uid)
      })
github syanbo / react-native-agora / samples / simpleDemo / components / agora.js View on Github external
audioProfile: AudioProfileDefault,
      audioScenario: AudioScenarioDefault
    };
    RtcEngine.on('firstRemoteVideoDecoded', (data) => {
      console.log('[RtcEngine] onFirstRemoteVideoDecoded', data);
    });
    RtcEngine.on('userJoined', (data) => {
      console.log('[RtcEngine] onUserJoined', data);
      const {peerIds} = this.state;
      if (peerIds.indexOf(data.uid) === -1) {
        this.setState({
          peerIds: [...peerIds, data.uid]
        })
      }
    });
    RtcEngine.on('userOffline', (data) => {
      console.log('[RtcEngine] onUserOffline', data);
      this.setState({
          peerIds: this.state.peerIds.filter(uid => uid !== data.uid)
      })
    });
    RtcEngine.on('joinChannelSuccess', (data) => {
      console.log('[RtcEngine] onJoinChannelSuccess', data);
      RtcEngine.startPreview();
      this.setState({
        joinSucceed: true
      })
    });
    RtcEngine.on('audioVolumeIndication', (data) => {
      console.log('[RtcEngine] onAudioVolumeIndication', data);
    });
    RtcEngine.on('clientRoleChanged', (data) => {