ios AVAggregateAssetDownloadTask不支持currentRequest属性

vx6bjr1n  于 11个月前  发布在  iOS
关注(0)|答案(1)|浏览(143)

我试图在iOS中使用react-native的native模块下载视频。相同的代码在独立的iOS应用程序中工作正常,但使用native模块调用时抛出错误。
错误-

Exception 'AVAggregateAssetDownloadTask does not support currentRequest property' was thrown while invoking downloadVideoUsingUri on target CacheVideoModule with params (
    "https://d14nfbmksdrc0w.cloudfront.net/Doctor_Strange_in_the_Multiverse_of_Madness_Official_Trailer/default.m3u8"
)
callstack: (
    0   CoreFoundation                      0x0000000193984e44 42CCFC7B-FF32-3D25-8F01-CCB2AD843A8B + 40516
    1   libobjc.A.dylib                     0x000000018cb1b8d8 objc_exception_throw + 60
    2   CFNetwork                           0x0000000194c820dc _CFNetworkErrorGetLocalizedDescription + 353964
    3   ExoPlayPOC                          0x00000001052521a0 __55+[FLEXNetworkObserver injectIntoNSURLSessionTaskResume]_block_invoke_2 + 52
    4   ExoPlayPOC                          0x0000000105780ec4 $s18react_native_video23AssetPersistenceManagerC14downloadStream3foryAA0D0C_tF + 1280
    5   ExoPlayPOC                          0x00000001057870a0 $s18react_native_video16CacheVideoModuleC08downloadE8UsingUriyySSF + 828
    6   ExoPlayPOC                          0x00000001057871ec $s18react_native_video16CacheVideoModuleC08downloadE8UsingUriyySSFTo + 60
    7   CoreFoundation                      0x00000001939ef6b4 42CCFC7B-FF32-3D25-8F01-CCB2AD843A8B + 476852
    8   CoreFoundation                      0x000000019399bb1c 42CCFC7B-FF32-3D25-8F01-CCB2AD843A8B + 133916
    9   CoreFoundation                      0x000000019399b534 42CCFC7B-FF32-3D25-8F01-CCB2AD843A8B + 132404
    10  ExoPlayPOC                          0x00000001053c136c -[RCTModuleMethod invokeWithBridge:module:arguments:] + 1744
    11  ExoPlayPOC                          0x00000001053c51b0 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicEiN12_GLOBAL__N_117SchedulingContextE + 1544
    12  ExoPlayPOC                          0x00000001053c49cc _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 144
    13  ExoPlayPOC                          0x00000001053c4930 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 28
    14  libdispatch.dylib                   0x000000010850453c _dispatch_call_block_and_release + 32
    15  libdispatch.dylib                   0x0000000108505ff0 _dispatch_client_callout + 20
    16  libdispatch.dylib                   0x000000010850e0a0 _dispatch_lane_serial_drain + 988
    17  libdispatch.dylib                   0x000000010850edc8 _dispatch_lane_invoke + 420
    18  libdispatch.dylib                   0x000000010851bcac _dispatch_workloop_worker_thread + 740
    19  libsystem_pthread.dylib             0x00000001e1bfcdf8 _pthread_wqthread + 288
    20  libsystem_pthread.dylib             0x00000001e1bfcb98 start_wqthread + 8
)

字符串
密码-

// Create the configuration for the AVAssetDownloadURLSession.
let backgroundConfiguration = URLSessionConfiguration.background(withIdentifier: "AAPL-Identifier")
        
// Create the AVAssetDownloadURLSession using the configuration.
let assetDownloadURLSession = AVAssetDownloadURLSession(configuration: backgroundConfiguration, assetDownloadDelegate: self, delegateQueue: OperationQueue.main)

let _asset = AVURLAsset(url: URL(string: "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8")!)
let preferredMediaSelection = _asset.preferredMediaSelection
guard let task =
   assetDownloadURLSession.aggregateAssetDownloadTask(with: _asset,
                                                      mediaSelections: [preferredMediaSelection],
                                                      assetTitle: "my asset",
                                                      assetArtworkData: nil,
                                                      options:
       [AVAssetDownloadTaskMinimumRequiredMediaBitrateKey: 265_000]) else { return }

task.taskDescription = "1"

task.resume()


没有太多关于这个错误. https://github.com/facebook/flipper/issues/2507.
我期待一些建议或解决这个错误,而使用它抛出本机模块在react-native。

wd2eg0qa

wd2eg0qa1#

这对我来说是因为flipper是一个在模拟器或物理设备上调试React Native项目的平台工具。它给了我你在离线下载视频时面临的同样的错误。
我发现在Podfile中禁用:flipper_configuration => FlipperConfiguration.disabled,可以在调试和发布时修复这个问题。
这是一台带鳍板的issue

相关问题