av_media_player 0.6.4 av_media_player: ^0.6.4 copied to clipboard
A lightweight media player for flutter. Which uses Texture Widget for video rendering. Backend builts on AVPlayer(ios/macos) and MediaPlayer(Android).
import 'package:flutter/material.dart';
import 'package:av_media_player/widget.dart';
void main() => runApp(const MyApp());
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
var _loading = true;
@override
Widget build(BuildContext context) => MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('av_media_player simple example'),
),
body: SizedBox.expand(
child: Stack(
alignment: Alignment.center,
children: [
AVMediaView(
initSource:
'https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8',
initLooping: true,
initAutoPlay: true,
onCreated: (player) => player.loading.addListener(
() => setState(() => _loading = player.loading.value)),
),
if (_loading) const CircularProgressIndicator(),
],
),
),
),
);
}