How to Play M3U8 Format Android & iOS on Flutter
Asked Answered
S

4

11

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)
Somite answered 27/8, 2019 at 21:43 Comment(5)
M3U is not video container, it is just text file with playlist.Earlineearls
I changed my question title, I forget "8"Somite
M3U8 its a playlist like M3U. Try to open it with notepad or any text editor.Earlineearls
I solved my problem with Webview. Webview can play m3u8 Url (playlist) at both platformSomite
Flicker_video_playerTrowbridge
P
8

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),
        ));
  }
}
Pleasance answered 5/7, 2020 at 15:32 Comment(4)
Is this working on iOS? In my case, it stucks on an infinite loading...Unload
Noted, thanks. I solved my problem, it was related to this: github.com/flutter/flutter/issues/48670.Unload
Is this working for web? @JiteshMohiteLives
Use late ChewieController chewieController; instead of ChewieController chewieController; when sound null safety is enabled.Pocked
T
1

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:)

Twinge answered 3/5, 2023 at 1:0 Comment(0)
B
0

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(),
  ),
Benignant answered 9/1, 2021 at 7:50 Comment(3)
some devices it doesn't work like Techno Spark 3Dare
yoyo_player : is not yet updated to work on flutter 2.5 , it shows some errors related to deprecated screen package...Nonanonage
Yoyo player seems not maintained, and is not a good choice to use at the momentEvansville
D
-1

best option is better_player or Flicker_video_player

Dodona answered 26/10, 2023 at 5:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.