tanersener / flutter-ffmpeg

FFmpeg plugin for Flutter. Not maintained anymore. Superseded by FFmpegKit.
GNU Lesser General Public License v3.0
645 stars 132 forks source link

iOS Build Error: 'kCMTimeZero' has been renamed to 'CMTime.zero' #104

Closed BasedMusa closed 4 years ago

BasedMusa commented 4 years ago

Description Working on video concatenation app, iOS build fails. Haven't checked on Android. I am on version 0.2.10.

Expected behavior To build successfully.

Logs

Launching lib/main.dart on iPhone 6s in debug mode...
Running pod install...
Running Xcode build...
Xcode build done.                                            7.4s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **

Xcode's output:
↳
    /Applications/Flutter-SDK/flutter/.pub-cache/hosted/pub.dartlang.org/native_video_view-0.1.8/ios/Classes/VideoView.swift:90:35: error: 'kCMTimeZero' has been renamed to 'CMTime.zero'
                self.player?.seek(to: kCMTimeZero)
                                      ^~~~~~~~~~~
                                      CMTime.zero
    CoreMedia.kCMTimeZero:3:12: note: 'kCMTimeZero' was obsoleted in Swift 4.2
    public let kCMTimeZero: CMTime
               ^
    /Applications/Flutter-SDK/flutter/.pub-cache/hosted/pub.dartlang.org/native_video_view-0.1.8/ios/Classes/VideoView.swift:149:45: error: missing argument labels 'value:timescale:' in call
                self.player?.seek(to: CMTimeMake(pos, 1000), toleranceBefore: kCMTimeZero, toleranceAfter: kCMTimeZero)
                                                ^
                                                 value:  timescale: 
    /Applications/Flutter-SDK/flutter/.pub-cache/hosted/pub.dartlang.org/native_video_view-0.1.8/ios/Classes/VideoView.swift:202:13: warning: switch covers known cases, but 'AVPlayer.Status' may have additional unknown values, possibly added in future versions
                switch(status){
                ^
    /Applications/Flutter-SDK/flutter/.pub-cache/hosted/pub.dartlang.org/native_video_view-0.1.8/ios/Classes/VideoView.swift:202:13: note: handle unknown values using "@unknown default"
                switch(status){
                ^
    /Applications/Flutter-SDK/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_ffmpeg-0.2.10/ios/Classes/FlutterFfmpegPlugin.m:82:15: warning: unused variable 'command' [-Wunused-variable]
        NSString* command = call.arguments[@"command"];
                  ^
    /Applications/Flutter-SDK/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_ffmpeg-0.2.10/ios/Classes/FlutterFfmpegPlugin.m:83:15: warning: unused variable 'delimiter' [-Wunused-variable]
        NSString* delimiter = call.arguments[@"delimiter"];
                  ^
    2 warnings generated.
    note: Using new build systemnote: Planning buildnote: Constructing build description

Could not build the application for the simulator.
Error launching application on iPhone 6s.

Environment

[✓] Flutter (Channel dev, v1.14.6, on Mac OS X 10.15.3 19D76, locale en-GB)
    • Flutter version 1.14.6 at /Applications/Flutter-SDK/flutter
    • Framework revision fabeb2a16f (4 weeks ago), 2020-01-28 07:56:51 -0800
    • Engine revision c4229bfbba
    • Dart version 2.8.0 (build 2.8.0-dev.5.0 fc3af737c7)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Applications/Android-SDK/
    • Android NDK location not configured (optional; useful for native profiling
      support)
    • Platform android-29, build-tools 28.0.3
    • ANDROID_HOME = /Applications/Android-SDK/
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.1, Build version 11A1027
    • CocoaPods version 1.8.4

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 40.2.2
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build
      1.8.0_202-release-1483-b49-5587405)

//I don't use this one, ignore.
[!] IntelliJ IDEA Community Edition (version 2019.3.1)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

[✓] VS Code (version 1.41.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.7.1

[✓] Connected device (3 available)
    • iPhone 6s  • 4C133A22-3A0D-4F4B-A839-A799BD3614E9 • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-11-1 (simulator)
    • Chrome     • chrome                               • web-javascript •
      Google Chrome 80.0.3987.116
    • Web Server • web-server                           • web-javascript •
      Flutter Tools

! Doctor found issues in 1 category.

Other

Podfile

# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def parse_KV_file(file, separator='=')
  file_abs_path = File.expand_path(file)
  if !File.exists? file_abs_path
    return [];
  end
  generated_key_values = {}
  skip_line_start_symbols = ["#", "/"]
  File.foreach(file_abs_path) do |line|
    next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
    plugin = line.split(pattern=separator)
    if plugin.length == 2
      podname = plugin[0].strip()
      path = plugin[1].strip()
      podpath = File.expand_path("#{path}", file_abs_path)
      generated_key_values[podname] = podpath
    else
      puts "Invalid plugin specification: #{line}"
    end
  end
  generated_key_values
end

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  # Flutter Pod

  copied_flutter_dir = File.join(__dir__, 'Flutter')
  copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
  copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
  unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
    # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
    # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
    # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.

    generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
    unless File.exist?(generated_xcode_build_settings_path)
      raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
    end
    generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
    cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];

    unless File.exist?(copied_framework_path)
      FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
    end
    unless File.exist?(copied_podspec_path)
      FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
    end
  end

  # Keep pod path relative so it can be checked into Podfile.lock.
  pod 'Flutter', :path => 'Flutter'

  # Plugin Pods

  # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
  # referring to absolute paths on developers' machines.
  system('rm -rf .symlinks')
  system('mkdir -p .symlinks/plugins')
  plugin_pods = parse_KV_file('../.flutter-plugins')
  plugin_pods.each do |name, path|
    symlink = File.join('.symlinks', 'plugins', name)
    File.symlink(path, symlink)
    pod name, :path => File.join(symlink, 'ios')
  end
end

# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
install! 'cocoapods', :disable_input_output_paths => true

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end
tanersener commented 4 years ago

Your logs show only two warnings about flutter_ffmpeg, actual errors are caused by native_video_view.

FlutterFfmpegPlugin.m:82:15: warning: unused variable 'command'
FlutterFfmpegPlugin.m:83:15: warning: unused variable 'delimiter'
BasedMusa commented 4 years ago

Sorry, I just saw that as well and come to close my issue, thanks for having a look!