0

I am new on flutter. I am trying to integrate video player in my app which can play m3u8 video but only some file can play when they only exoplayer user_agent.

and when I shift to webview than it's dropping frames please help me to find the answer.

I used chewie_player , video_player , loco_player to make it work but none of them works properly.

HoRiz
  • 706
  • 4
  • 15

1 Answers1

0

Play m3u8 file using chewie: ^1.4.0. Go to package

chewie package supports both Android and iOS platforms. This package provides a video player widget based on ExoPlayer.

  • Install chewie to your flutter project

     flutter pub add chewie
    
  • example Code:

    class MyApp extends StatefulWidget {
      @override
      _MyAppState createState() => _MyAppState();
    }
    
    class _MyAppState extends State<MyApp> {
      final videoPlayerController = VideoPlayerController.network(
          'url.m3u8');
      ChewieController chewieController;
    
    @override
    void initState() {
      super.initState();
      chewieController = ChewieController(
        videoPlayerController: videoPlayerController,
        aspectRatio: 3 / 2,
        autoPlay: true,
        looping: true,
      );
    }
    
    @override
    Widget build(BuildContext context) {
      return Scaffold(
          appBar: AppBar(
            title: Text("Sample App"),
          ),
          body: Container(
            child: Chewie(controller: chewieController),
          ));
    }
    }
    
HoRiz
  • 706
  • 4
  • 15
  • thanks for your response, Although it doesn't the problem yet. I tried to use it but it still give an error "com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 403" Please use this url as a demo https://wwwx17.gofcdn.com/videos/hls/A7DVIdr74YFUnNYjYgJw9A/1676490339/88386/395c00c8e81e269aa76202288b5c4727/ep.2.1660628444.m3u8 – dhruv aggarwal Feb 15 '23 at 16:09