我正在尝试从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运行良好。
答案 0 :(得分:1)
该视频播放器无法在iOS模拟器上运行。开发/测试期间必须使用iOS设备。
将以下条目添加到/ios/Runner/Info.plist中的Info.plist文件中:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>