How aws/amazon-ivs-react-native-player works
Main Components
• JavaScript/React Native Layer – This is primarily represented in the src directory and relevant configuration files (e.g., package.json, tsconfig.json). This layer exports the IVSPlayer component, which is the bridge between your React Native app and the native modules.
• Android Native Module – Found in the android directory, including Kotlin files (e.g., AmazonIvsPackage.kt, AmazonIvsView.kt, and AmazonIvsViewManager.kt) and Gradle build scripts. This component encapsulates the Android-specific implementation of the player.
• iOS Native Module – The ios directory contains the iOS-specific code (Objective-C and Swift, like AmazonIvsManager.m, AmazonIvsManager.swift, and AmazonIvsView.swift) that implements the corresponding native functionality.
• Example Applications – The example folder demonstrates how the library is integrated into a React Native app with platform-specific code (both Android and iOS projects are present). This illustrates real-world usage.
• Build and Configuration Process – Although not a system component, include references to build files (podspec, Gradle files, podfile) and configuration scripts that orchestrate the build, deployment, and testing of the native modules and JS bundle.
Relationships and Interactions
• Data/Command Flow – Show how the IVSPlayer React component (from the JS layer) invokes methods on the native modules through the React Native Bridge.
• Native to JavaScript Communication – Indicate callbacks or event propagation mechanisms originating from the native modules returning signals or events to the JS layer.
• Example App Integration – Optionally show how the sample app wraps these components together, demonstrating usage both in the development sample and as a guide for integration.
Architectural Patterns and Design Principles
• Bridge Pattern – The React Native Bridge that connects the JavaScript layer with the native modules should be emphasized.
• Separation of Concerns – Distinct boundaries exist between presentation (JS components), native implementation (platform code), and build/configuration (Gradle, Podfiles, etc.).
• Modular Design – Each platform-specific module is self-contained (with its own configurations) and can be independently tested (as seen from the existence of e2e tests and example projects).
Relevant Technologies, Frameworks, and Libraries
• React Native – Serving as the primary framework for the JavaScript layer.
• Native SDKs – iOS and Android native code that interacts directly with the Amazon IVS SDK.
• Build Tools – For Android: Gradle; for iOS: CocoaPods (with the .podspec file); and Node.js based tools for running JavaScript tests (e.g., Jest in the e2e folder).
• Testing Frameworks – E2E tests and unit tests present within __tests__ and e2e directories.