Nessuna descrizione

RtcEngine.js 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import {
  2. NativeModules,
  3. findNodeHandle,
  4. NativeAppEventEmitter
  5. } from 'react-native';
  6. const { Agora } = NativeModules
  7. export default {
  8. ...Agora,
  9. init(options = {}) {
  10. this.listener && this.listener.remove();
  11. Agora.init(options);
  12. },
  13. joinChannel(channelName = '00001', uid = 0){
  14. Agora.joinChannel(channelName, uid);
  15. },
  16. joinChannelWithToken(token, channelName = '00001', uid = 0){
  17. Agora.joinChannelWithToken(token, channelName, uid);
  18. },
  19. eventEmitter(fnConf) {
  20. //there are no `removeListener` for NativeAppEventEmitter & DeviceEventEmitter
  21. this.listener && this.listener.remove();
  22. this.listener = NativeAppEventEmitter.addListener('agoraEvent', event => {
  23. fnConf[event['type']] && fnConf[event['type']](event);
  24. });
  25. },
  26. removeEmitter() {
  27. this.listener && this.listener.remove();
  28. },
  29. enableLastmileTest() {
  30. Agora.enableLastmileTest();
  31. },
  32. disableLastmileTest() {
  33. Agora.disableLastmileTest();
  34. },
  35. };