Ei kuvausta

AgoraView.native.js 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const tslib_1 = require("tslib");
  4. const react_1 = tslib_1.__importDefault(require("react"));
  5. const react_native_1 = require("react-native");
  6. /**
  7. * Import RCTAgoraView from native binding.
  8. *
  9. * This @object is used to bridge native layer between react layer.
  10. */
  11. const RCTAgoraView = react_native_1.requireNativeComponent("RCTAgoraVideoView");
  12. /**
  13. * AgoraView is the render layer for rendering video stream
  14. *
  15. * This class is used to rendering native sdk stream
  16. * @props {@link AgoraViewProps}
  17. *
  18. * @descrption AgoraViewProps has four properties.
  19. * @property mode: {@link AgoraViewMode}, this property will setup video render mode. You could see more [details](https://docs.agora.io/en/Interactive%20Broadcast/API%20Reference/java/classio_1_1agora_1_1rtc_1_1_rtc_engine.html#ac08882c4d0ec47b329900df169493673)
  20. * @property showLocalVideo: boolean, this property will render local video, NOTICE: IF YOU SET showLocalVideo YOU CANNOT SET remoteUid
  21. * @property remoteUid: number, this property will render video with remote uid, NOTICE: IF YOU SET remoteUid YOU CANNOT SET showLocalVideo
  22. * @property zOrderMediaOverlay: boolean, this property will working for android side and it likes zIndex behaviour on web side.
  23. *
  24. * @noInheritDoc
  25. */
  26. class AgoraView extends react_1.default.Component {
  27. /**
  28. * render
  29. *
  30. * It would render view for VideoStream
  31. */
  32. render() {
  33. return (react_1.default.createElement(RCTAgoraView, Object.assign({}, this.getHTMLProps())));
  34. }
  35. /**
  36. * getHTMLProps
  37. *
  38. * get agora view props
  39. */
  40. getHTMLProps() {
  41. let htmlProps = {};
  42. for (let key in this.props) {
  43. htmlProps[key] = this.props[key];
  44. }
  45. // convert uint32 to int32 for android
  46. if (react_native_1.Platform.OS === 'android') {
  47. const int32 = new Int32Array(1);
  48. int32[0] = htmlProps.remoteUid;
  49. htmlProps.remoteUid = int32[0];
  50. }
  51. return htmlProps;
  52. }
  53. }
  54. exports.default = AgoraView;
  55. //# sourceMappingURL=AgoraView.native.js.map