【问题标题】:Error while running video in flutter video player在颤振视频播放器中运行视频时出错
【发布时间】:2019-12-10 17:45:22
【问题描述】:

我正在尝试从 video_player flutter 运行视频,它在 android 中完美运行,但在 ios 中,我收到以下错误但有时它在给出错误后运行。

_controller = VideoPlayerController.network(widget._videoUrl)
          ..initialize().then((_) {
            _controller.play();
            setState(() {
              this.duration = this._controller.value.duration.inSeconds;
              this._controller.addListener(videoControlListner);
            });
          });
    
    

错误:

_NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <241959D4-879B-4279-9E48-FE823592A71D>.<6>, NSLocalizedDescription=cancelled} [-999]
        [C5.1 1D473D7C-2EF2-4AF5-99CD-CCAB9560AA45 192.168.1.13:51979<->52.216.160.155:443]
        Connected Path: satisfied (Path is satisfied), interface: en0
        Duration: 7.716s, DNS @0.004s took 0.008s, TCP @0.021s took 0.323s, TLS took 0.609s
        bytes in/out: 24202/1709, packets in/out: 31/4, rtt: 0.315s, retransmitted packets: 0, out-of-order packets: 0

此行为仅在 IOS 中,Android 运行良好。

【问题讨论】:

    标签: flutter dart


    【解决方案1】:

    视频播放器在 iOS 模拟器上不起作用。开发/测试期间必须使用 iOS 设备。

    将以下条目添加到位于 /ios/Runner/Info.plist 中的 Info.plist 文件中:

    <key>NSAppTransportSecurity</key>
    <dict>
      <key>NSAllowsArbitraryLoads</key>
      <true/>
    </dict>
    

    【讨论】:

    • 我在设备上运行它。
    猜你喜欢
    • 2021-09-13
    • 1970-01-01
    • 2021-04-03
    • 1970-01-01
    • 2020-06-13
    • 2022-07-22
    • 2020-03-02
    • 2023-03-08
    • 2021-10-28
    相关资源
    最近更新 更多