1. 安裝
git clone https://github.com/Bilibili/ijkplayer.git ijkplayer-ios
cd ijkplayer-ios
git checkout -B latest k0.8.8

./init-ios.sh

cd ios
./compile-ffmpeg.sh clean
./compile-ffmpeg.sh all
  1. 會遇到armv7的錯誤,再根據這篇修改參數 --enable-pic --disable-asm
elif [ "$FF_ARCH" = "armv7" ]; then
FF_BUILD_NAME="ffmpeg-armv7"
FF_BUILD_NAME_OPENSSL=openssl-armv7
FF_XCRUN_OSVERSION="-miphoneos-version-min=6.0"
FF_XCODE_BITCODE="-fembed-bitcode"
FFMPEG_CFG_FLAGS="$FFMPEG_CFG_FLAGS --enable-pic --disable-asm"
  1. 安裝成功後,打開 ios/IJKMediaPlayer/IJKMediaPlayer.xcodeproj,同時在模擬器跟實機 build 一下。
  2. 合併兩種 framework。
  3. Release-iphoneos/IJKMediaFramework.framework 拖入项目中,导入依赖库
  4. 再把下面的 framework 也通通加入
    • AudioToolbox.framework
    • AVFoundation.framework
    • CoreGraphics.framework
    • CoreMedia.framework
    • CoreVideo.framework
    • libbz2.tbd
    • libz.tbd
    • MediaPlayer.framework
    • MobileCoreServices.framework
    • OpenGLES.framework
    • QuartzCore.framework
    • UIKit.framework
    • VideoToolbox.framework
    • libstdc++.6.0.9.tbd
  5. 但是會找不到 libstdc++.6.0.0.tbd,所以就改加 libc++.tbd
  6. 完成

參考

  1. https://www.hangge.com/blog/cache/detail_1326.html
  2. https://www.hangge.com/blog/cache/detail_1327.html