0

i'm using chewieController to play a video from the database, using postman or when i parse the link in the browser,the video gets loaded successfuly. But in flutter i get an error showing that the source error is null , and i'm sure that the link inside the videoPlayer controler.network is right **PlatformException(VideoError, Video player had error com.google.android.exoplayer2.ExoPlaybackException: Source error, null, null) **



class _VideoPlayerState extends State<ChewiVideoAsset> {
  ChewieController? chewieController;
  late VideoPlayerController videoController;

  Future initVideo() async {
    videoController = VideoPlayerController.network(
        'http://$SERVER_IP:8083/ukla/file-system-video/video/20');
    await videoController.initialize();

    chewieController = ChewieController(
        videoPlayerController: videoController,
        showControls: true,
        aspectRatio: videoController.value.aspectRatio,
        showControlsOnInitialize: false,
        allowFullScreen: true,
        autoInitialize: true,
        autoPlay: false,
        looping: false,
        errorBuilder: (context, string) {
          return Center(
              child: Text(
            string,
            style: const TextStyle(color: Colors.white),
          ));
        },
        allowPlaybackSpeedChanging: true,
        materialProgressColors: ChewieProgressColors(
          playedColor: Colors.red,
        ));

    setState(() {});
  }

  @override
  void initState() {
    super.initState();
    initVideo();
  }

  @override
  Widget build(BuildContext context) {
    if (chewieController == null) {
      return Center(
        child: CircularProgressIndicator(),
      );
    }
    return Chewie(
      controller: chewieController!,
    );


I tried with a link like 'https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4' in VideoController.network and it actually get loaded successfuly and the video plays .

Khalil2K
  • 19
  • 3

0 Answers0