Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
#include <string>
#include <memory>

#if ANDROID
#include <fbjni/detail/Environment.h>
#endif

#ifndef RN_AUDIO_API_TEST
#define RN_AUDIO_API_TEST 0
#endif
Expand Down Expand Up @@ -71,7 +75,7 @@ struct RuntimeRegistry {

#if ANDROID
~RuntimeRegistry() {
jni::ThreadScope::WithClassLoader(
facebook::jni::ThreadScope::WithClassLoader(
[this]() {
uiRuntime.reset();
audioRuntime.reset();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}