import 'package:flutter/material.dart'; import 'package:video_viewer/video_viewer.dart'; class HLSVideoExample extends StatelessWidget { @override Widget build(BuildContext context) { return FutureBuilder>( future: VideoSource.fromM3u8PlaylistUrl( "https://sfux-ext.sfux.info/hls/chapter/105/1588724110/1588724110.m3u8", formatter: (quality) => quality == "Auto" ? "Automatic" : "${quality.split("x").last}p", ), builder: (_, data) { return data.hasData ? VideoViewer( source: data.data, onFullscreenFixLandscape: true, style: VideoViewerStyle( thumbnail: Image.network( "https://play-lh.googleusercontent.com/aA2iky4PH0REWCcPs9Qym2X7e9koaa1RtY-nKkXQsDVU6Ph25_9GkvVuyhS72bwKhN1P", ), ), ) : CircularProgressIndicator(); }, ); } }