How to Play M3U8 Format Android & iOS on Flutter

17.4k Views Asked by At

I can't find any solution for M3U8 Url player on iOS

I tried these plugins;

  • video_player (Can't play)
  • flutter_simple_video_player (Only support Android)
4

There are 4 best solutions below

4
On BEST ANSWER

chewie lib will be used for playing m3u8 files

Add Dependency

dependencies:
  chewie: ^0.9.10

Code Snippet:

import 'package:flutter/material.dart';
import 'package:chewie/chewie.dart';
import 'package:video_player/video_player.dart';

void main() {
  runApp(MaterialApp(home: MyApp()));
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final videoPlayerController = VideoPlayerController.network(
      'https://live-par-1-abr-cdn.livepush.io/live_abr_cdn/emaIqCGoZw-6/index.m3u8');
  late ChewieController chewieController;

  @override
  void initState() {
    // TODO: implement 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),
        ));
  }
}
0
On

best option is better_player or Flicker_video_player

0
On

yoyo player is best choice but this package dont support your project, you can use this package, i changed yaml and update this package , for update flutter,

 yoyo_player:
    git:
      url: https://github.com/AmiirTorabii/yoyo_player_update

its work for me:)

3
On

YoYo player is a great choice.

  1. Add dependency:

yoyo_player: #latest

  1. Use anywhere you want:
 YoYoPlayer(
       aspectRatio: 16 / 9,
       url:  "",
       videoStyle: VideoStyle(),
       videoLoadingStyle: VideoLoadingStyle(),
  ),