Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.
This repository was archived by the owner on Jun 23, 2025. It is now read-only.

Custom-Built ffmpeg-kit-react-native: NativeModule === null - why? #1142

@vpume

Description

@vpume

Hi,
I try to build a custom version of the ffmpeg-kit-react-native package on macOS, for iOS devices as target.

I did the following steps:

  • forked your repo
  • brew install autoconf automake libtool pkg-config curl git doxygen nas
  • ./ios.sh -x
  • ln -s ~/git/ffmpeg-kit/prebuilt/bundle-apple-xcframework-ios ~/git/ffmpeg-kit/bundle-apple-xcframework-ios
  • change ffmpeg-kit-react-native.prodspec to (according to How to use my custom building? #537 (comment))
require "json"

package = JSON.parse(File.read(File.join(__dir__, "package.json")))

Pod::Spec.new do |s|
  s.name         = package["name"]
  s.version      = package["version"]
  s.summary      = package["description"]
  s.homepage     = package["homepage"]
  s.license      = package["license"]
  s.authors      = package["author"]

  s.platform          = :ios
  s.requires_arc      = true
  s.static_framework  = true

  s.source       = { :path => '/~/git/ffmpeg-kit/bundle-apple-xcframework-ios' }

  # https://github.com/arthenica/ffmpeg-kit/issues/537#issuecomment-1873589426
  s.source_files = 'FFmpegKitReactNativeModule.m', 'FFmpegKitReactNativeModule.h', 'bundle-apple-xcframework-ios/**/*.{h,m,swift}'
  s.vendored_frameworks = 'bundle-apple-xcframework-ios/ffmpegkit.xcframework',
                              'bundle-apple-xcframework-ios/libavcodec.xcframework',
                              'bundle-apple-xcframework-ios/libavdevice.xcframework',
                              'bundle-apple-xcframework-ios/libavfilter.xcframework',
                              'bundle-apple-xcframework-ios/libavformat.xcframework',
                              'bundle-apple-xcframework-ios/libavutil.xcframework',
                              'bundle-apple-xcframework-ios/libswresample.xcframework',
                              'bundle-apple-xcframework-ios/libswscale.xcframework'
  s.ios.deployment_target = '12.1'
  s.dependency "React-Core"
  1. changing package.json of my target app to use my local build: "ffmpeg-kit-react-native": "file:/~/git/ffmpeg-kit/react-native"

building works fine, however, when I run the app, the first time an ffmpeg function is begin used, I get the error Invariant Violation, message: new NativeEventEmitter()requires a non-null argument., stack: Invariant Violation:new NativeEventEmitter() requires a non-null argument.

I tracked down the exact location of the error:

Image

It seems like the FfmpegKitReactNativeModule.m is not being loaded. But if I look in the node_modules folder of the target app, it is all there:

Image

Can anybody give me a hint on what could be the problem? Native Modules are not really my core competence, so I'm a bit lost here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    react-nativeAffect react-native platform

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions