Я пытаюсь воспроизвести видео из inte rnet, используя метод VideoPlayerController.netWork (), но каждый URL-адрес, с которым я пробую, сталкивается с ошибкой, указанной ниже:
Ошибка источника. E / flutter (4250): [ОШИБКА: flutter / lib / ui / ui_dart_state. cc (157)] Необработанное исключение: PlatformException (VideoError, Произошла ошибка проигрывателя видео com.google. android .exoplayer2.ExoPlaybackException: com. google. android .exoplayer2.upstream.HttpDataSource $ HttpDataSourceException: невозможно подключиться к https://file-examples.com/wp-content/uploads/2017/04/file_example_MP4_480_1_5MG.mp4, null) E / flutter (4250): # 0 ChewieController._initialize (пакет: chewie / src / chewie_player .dart: 291: 7) E / flutter (4250): E / flutter (4250): # 1 новый ChewieController (пакет: chewie / src / chewie_player.dart: 197: 5) E / flutter (4250): # 2 _ChewieListState .initState (пакет: flutterappvideoandshit /screen / chewie_list.dart: 20: 25) E / flutter (4250): # 3 StatefulElement._firstBuild (пакет: flutter / src / widgets / framework.dart: 4640: 58) E / flutter ( 4250): # 4 ComponentElement.mount (пакет: flutter / src / widgets / framework.dart: 4476: 5) E / flutter (4250): # 5 Element.inflateWidget (пакет: flutter / src / widgets / framework.dart: 3446: 14) E / flutter (4250): # 6 Element.updateChild (пакет: flutter / src / widg ets / framework.dart: 3214: 18) E / flutter (4250): # 7 SingleChildRenderObjectElement.mount (пакет: flutter / src / widgets / framework.dart: 5830: 14) E / flutter (4250): элемент # 8. inflateWidget (пакет: flutter / src / widgets / framework.dart: 3446: 14) E / flutter (4250): # 9 Element.updateChild (пакет: flutter / src / widgets / framework.dart: 3214: 18) E / flutter (4250): # 10 SingleChildRenderObjectElement.mount (пакет: flutter / src / widgets / framework.dart: 5830: 14) E / flutter (4250): # 11 Element.inflateWidget (пакет: flutter / src / widgets / framework.dart : 3446: 14) E / flutter (4250): # 12 Element.updateChild (пакет: flutter / src / widgets / framework.dart: 3214: 18) E / flutter (4250): # 13 ComponentElement.performRebuild (пакет: flutter /src/widgets/framework.dart:4527:16) E / flutter (4250): # 14 Element.rebuild (пакет: flutter / src / widgets / framework.dart: 4218: 5) E / flutter (4250): # 15 ComponentElement._firstBuild (пакет: flutter / src / widgets / framework.dart: 4481: 5) E / flutter (4250): # 16 ComponentElement.mount (пакет: flu tter / src / widgets / framework.dart: 4476: 5) E / flutter (4250): # 17 Element.inflateWidget (пакет: flutter / src / widgets / framework.dart: 3446: 14) E / flutter (4250): # 18 Element.updateChild (пакет: flutter / src / widgets / framework.dart: 3214: 18) E / flutter (4250): # 19 ComponentElement.performRebuild (пакет: flutter / src / widgets / framework.dart: 4527: 16 ) E / flutter (4250): # 20 Element.rebuild (пакет: flutter / src / widgets / framework.dart: 4218: 5) E / flutter (4250): # 21 ComponentElement._firstBuild (пакет: flutter / src / widgets /framework.dart:4481:5) E / flutter (4250): # 22 ComponentElement.mount (пакет: flutter / src / widgets / framework.dart: 4476: 5) E / flutter (4250): # 23 Element.inflateWidget (пакет: flutter / src / widgets / framework.dart: 3446: 14) E / flutter (4250): # 24 Element.updateChild (пакет: flutter / src / widgets / framework.dart: 3214: 18) E / flutter ( 4250): # 25 ComponentElement.performRebuild (пакет: flutter / src / widgets / framework.dart: 4527: 16) E / flutter (4250): # 26 StatefulElement.performRebuild (пакет: flutter / src / widgets / framework.dart: 4675: 11) E / flutter (4250): # 27 Element.rebuild (пакет: flutter / src / widgets / framework.dart: 4218: 5) E / flutter (4250): # 28 ComponentElement._firstBuild (пакет: flutter / src / widgets / framework.dart: 4481: 5) E / flutter (4250): # 29 StatefulElement._firstBuild (пакет: flutter / src / widgets / framework.dart: 4666: 11 ) E / flutter (4250): # 30 ComponentElement.mount (пакет: flutter / src / widgets / framework.dart: 4476: 5) E / flutter (4250): # 31 Element.inflateWidget (пакет: flutter / src / widgets /framework.dart:3446:14) E / flutter (4250): # 32 Element.updateChild (пакет: flutter / src / widgets / framework.dart: 3214: 18) E / flutter (4250): # 33 ComponentElement.performRebuild (пакет: flutter / src / widgets / framework.dart: 4527: 16) E / flutter (4250): # 34 Element.rebuild (пакет: flutter / src / widgets / framework.dart: 4218: 5) E / flutter (4250): # 35 ComponentElement._firstBuild (пакет: flutter / src / widgets / framework.dart: 4481: 5) E / flutter (4250): # 36 ComponentElement.mount ( пакет: flutter / src / widgets / framework.dart: 4476: 5) E / flutter (4250): # 37 Element.inflateWidget (пакет: flutter / src / widgets / framework.dart: 3446: 14) E / flutter (4250) ): # 38 Element.updateChild (пакет: flutter / src / widgets / framework.dart: 3214: 18) E / flutter (4250): # 39 SliverMultiBoxAdaptorElement.updateChild (пакет: flutter / src / widgets / sliver.dart: 1147 : 36) E / flutter (4250): # 40 SliverMultiBoxAdaptorElement.createChild. (пакет: flutter / src / widgets / sliver.dart: 1132: 20) E / flutter (4250): # 41 BuildOwner.buildScope (пакет: flutter / src / widgets / framework.dart: 2607: 19)
и вот мой код:
import 'package:video_player/video_player.dart';
import 'package:chewie/chewie.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: HomePage(),
);
}
}
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Video Player"),
),
body: ListView(
children: <Widget>[
ChewieList(
videoPlayerController: VideoPlayerController.asset('assets/videos/soccer.mp4'),
looping: true,
),
ChewieList(
videoPlayerController: VideoPlayerController.network(
'https://file-examples.com/wp-content/uploads/2017/04/file_example_MP4_480_1_5MG.mp4'),
),
/*
ChewieList(
videoPlayerController: VideoPlayerController.network(
'http://file-examples.com/wp-content/uploads/2017/04/file_example_MP4_480_1_5MG.mp4'),
)
*/
],
),
);
}
}
class ChewieList extends StatefulWidget {
ChewieList({@required this.videoPlayerController,this.looping,Key key,}) : super(key:key);
final VideoPlayerController videoPlayerController;
final bool looping;
@override
_ChewieListState createState() => _ChewieListState();
}
class _ChewieListState extends State<ChewieList> {
ChewieController _chewieController;
@override
void initState() {
// TODO: implement initState
super.initState();
_chewieController = ChewieController(
videoPlayerController: widget.videoPlayerController,
aspectRatio: 16/9,
autoInitialize: true,
looping: widget.looping,
errorBuilder: (context,errMsg){
return Center(
child:Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Icon(Icons.warning,color: Colors.yellowAccent,),
Text("!خطایی در برقراری ارتباط رخ داده است",style: TextStyle(color: Colors.white),)
],
),
);
}
);
}
@override
void dispose() {
// TODO: implement dispose
super.dispose();
widget.videoPlayerController.dispose();
_chewieController.dispose();
}
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.all(8.0),
child: Chewie(
controller: _chewieController,
),
);
}
}
это сводит меня с ума !!!! ребята, пожалуйста, помогите мне.