diff --git a/packages/react-native-audio-api/android/src/main/cpp/audioapi/CMakeLists.txt b/packages/react-native-audio-api/android/src/main/cpp/audioapi/CMakeLists.txt index 65739142b..b41ddcac2 100644 --- a/packages/react-native-audio-api/android/src/main/cpp/audioapi/CMakeLists.txt +++ b/packages/react-native-audio-api/android/src/main/cpp/audioapi/CMakeLists.txt @@ -14,9 +14,6 @@ set(FFMPEG_INCLUDE_DIR ${COMMON_CPP_DIR}/audioapi/external/ffmpeg_include) set(EXTERNAL_DIR ${COMMON_CPP_DIR}/audioapi/external) set(JNI_LIBS_DIR ${COMMON_CPP_DIR}/../../android/src/main/jniLibs) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-Bsymbolic") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-Bsymbolic") - add_library(react-native-audio-api SHARED ${ANDROID_CPP_SOURCES} ${COMMON_CPP_SOURCES}) foreach(lib IN ITEMS opus opusfile ogg vorbis vorbisenc vorbisfile crypto ssl) diff --git a/packages/react-native-audio-api/common/cpp/audioapi/core/utils/worklets/SafeIncludes.h b/packages/react-native-audio-api/common/cpp/audioapi/core/utils/worklets/SafeIncludes.h index 6b3cf231a..863c6bf67 100644 --- a/packages/react-native-audio-api/common/cpp/audioapi/core/utils/worklets/SafeIncludes.h +++ b/packages/react-native-audio-api/common/cpp/audioapi/core/utils/worklets/SafeIncludes.h @@ -5,6 +5,10 @@ #include #include +#if ANDROID + #include +#endif + #ifndef RN_AUDIO_API_TEST #define RN_AUDIO_API_TEST 0 #endif @@ -71,7 +75,7 @@ struct RuntimeRegistry { #if ANDROID ~RuntimeRegistry() { - jni::ThreadScope::WithClassLoader( + facebook::jni::ThreadScope::WithClassLoader( [this]() { uiRuntime.reset(); audioRuntime.reset(); diff --git a/packages/react-native-audio-api/scripts/download-prebuilt-binaries.sh b/packages/react-native-audio-api/scripts/download-prebuilt-binaries.sh index 03a5d4f7f..c6d56b151 100755 --- a/packages/react-native-audio-api/scripts/download-prebuilt-binaries.sh +++ b/packages/react-native-audio-api/scripts/download-prebuilt-binaries.sh @@ -11,37 +11,46 @@ DOWNLOAD_NAMES=( # Use a temporary directory for downloads, ensuring it exists TEMP_DOWNLOAD_DIR="$(pwd)/audioapi-binaries-temp" mkdir -p "$TEMP_DOWNLOAD_DIR" -if [ $1 == "android" ] -then + +if [ "$1" == "android" ]; then PROJECT_ROOT="$(pwd)/.." else PROJECT_ROOT="$(pwd)" fi +JNILIBS_DESTINATION="${PROJECT_ROOT}/android/src/main" +NORMAL_DESTINATION="${PROJECT_ROOT}/common/cpp/audioapi/external" + for name in "${DOWNLOAD_NAMES[@]}"; do ARCH_URL="${MAIN_DOWNLOAD_URL}/${TAG}/${name}" ZIP_FILE_PATH="${TEMP_DOWNLOAD_DIR}/${name}" + # Get the directory name from the zip name (e.g., "armeabi-v7a.zip" -> "armeabi-v7a") + EXTRACTED_DIR_NAME="${name%.zip}" + + # Determine the final output path if [[ "$name" == "jniLibs.zip" ]]; then - OUTPUT_DIR="${PROJECT_ROOT}/android/src/main" + OUTPUT_DIR="${JNILIBS_DESTINATION}" else - OUTPUT_DIR="${PROJECT_ROOT}/common/cpp/audioapi/external" + OUTPUT_DIR="${NORMAL_DESTINATION}" fi + FINAL_CHECK_PATH="${OUTPUT_DIR}/${EXTRACTED_DIR_NAME}" - mkdir -p "$OUTPUT_DIR" - - if [ -f "$ZIP_FILE_PATH" ]; then - echo "Zip file already exists locally. Skipping download." + if [ -d "$FINAL_CHECK_PATH" ]; then continue fi + + # If we are here, the directory does not exist, so we download and unzip. echo "Downloading from: $ARCH_URL" curl -fsSL "$ARCH_URL" -o "$ZIP_FILE_PATH" if [ $? -ne 0 ]; then + echo "Error: Download failed for ${name}." rm -f "$ZIP_FILE_PATH" continue fi + echo "Unzipping ${name} to ${OUTPUT_DIR}" unzip -o "$ZIP_FILE_PATH" -d "$OUTPUT_DIR" # Clean up any __MACOSX directories that may have been created diff --git a/packages/react-native-audio-api/scripts/validate-worklets-version.js b/packages/react-native-audio-api/scripts/validate-worklets-version.js index 965af621e..97bc599b8 100644 --- a/packages/react-native-audio-api/scripts/validate-worklets-version.js +++ b/packages/react-native-audio-api/scripts/validate-worklets-version.js @@ -21,8 +21,8 @@ function validateVersion() { } if (!validateVersion()) { - console.error( - 'Incompatible version of react-native-audio-worklets detected. Please install a compatible version.', + console.warn( + '[RNAudioApi] Incompatible version of react-native-audio-worklets detected. Please install a compatible version if you want to use worklet nodes in react-native-audio-api.', ); process.exit(1); }