omni_player 0.1.9
omni_player: ^0.1.9 copied to clipboard
Flutter媒体播放器插件,在Android/iOS上支持视频和音频播放和后台播放。支持MKV、MP4、HLS等.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'player_page.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'OmniPlayer Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
colorSchemeSeed: Colors.deepPurple,
useMaterial3: true,
),
home: const HomePage(),
);
}
}
class HomePage extends StatelessWidget {
const HomePage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('OmniPlayer'),
centerTitle: true,
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.play_circle_outline,
size: 80,
color: Theme.of(context).colorScheme.primary,
),
const SizedBox(height: 24),
const Text(
'Flutter 媒体播放器插件',
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
),
const SizedBox(height: 8),
Text(
'支持 MKV、MP4、HLS 等格式',
style: TextStyle(fontSize: 14, color: Colors.grey[600]),
),
const SizedBox(height: 32),
FilledButton.icon(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (_) => const PlayerPage()),
);
},
icon: const Icon(Icons.play_arrow),
label: const Text('进入播放示例'),
style: FilledButton.styleFrom(
padding:
const EdgeInsets.symmetric(horizontal: 32, vertical: 16),
),
),
],
),
),
);
}
}