初始化一个新的VideoPlayerController后,我在控制台中得到与此类似的输出:
[43.1 9320C4C3-349A-420C-B60D-4074259E7BF1 10.0.0.7.63778<->52.72.148.144:80]
Connected Path: satisfied (Path is satisfied), interface: en0
Duration: 30.601s, DNS @0.000s took 0.041s, TCP @0.042s took 0.001s
bytes in/out: 638/386, packets in/out: 1/1, rtt: 0.066s, retransmitted packets: 0, out-of-order packets: 0
初始化控制器和播放网络视频后,这些行会打印几次。
我的代码(如下)直接来自this页面上的示例代码。
这是预期的吗?我可以抑制此输出吗?
class _MyHomePageState extends State<MyHomePage> {
VideoPlayerController _controller;
bool _isPlaying = false;
@override
void initState() {
super.initState();
_controller = new VideoPlayerController.network(
'http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_20mb.mp4',
)
..addListener(() {
final bool isPlaying = _controller.value.isPlaying;
if (isPlaying != _isPlaying) {
setState(() {
_isPlaying = isPlaying;
});
}
})
..initialize(); // <-- This is the line that first prints the output
}
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text(widget.title),
),
body: new Center(
child: new Padding(
padding: const EdgeInsets.all(10.0),
child: new AspectRatio(
aspectRatio: 1280 / 720,
child: new VideoPlayer(_controller),
),
),
),
floatingActionButton: new FloatingActionButton(
onPressed:
_controller.value.isPlaying ? _controller.pause : _controller.play,
child: new Icon(
_controller.value.isPlaying ? Icons.pause : Icons.play_arrow,
),
),
);
}
}
答案 0 :(得分:0)
它似乎只是TCP调试信息供您自己参考,因此您可以验证VideoPlayer的实际网络端是否正常运行(这是一个半错误的插件 - 例如,我在Android上的WEBMs遇到了麻烦) 。如果您要发布发布版本并希望确保没有进行不必要的日志记录,则可以直接更改插件源。