zeba_academy_offline_media_player 1.0.0
zeba_academy_offline_media_player: ^1.0.0 copied to clipboard
Offline audio & video player with playlist, subtitles, shuffle/repeat, and speed control.
zeba_academy_offline_media_player #
Offline audio & video player for Flutter apps with playlist, subtitles, shuffle/repeat, and speed control.
Features #
- Play audio and video files from local storage
- Subtitle support for video files
- Playlist management with next, previous, and current tracking
- Shuffle and repeat modes
- Playback speed control
- Easy integration with Flutter apps
Installation #
Add this to your pubspec.yaml:
dependencies:
zeba_academy_offline_media_player:
git:
url: https://github.com/sufyanism/zeba_academy_offline_media_player.git
Then run:
flutter pub get
Usage #
import 'package:flutter/material.dart';
import 'package:zeba_academy_offline_media_player/zeba_academy_offline_media_player.dart';
import 'package:chewie/chewie.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Offline Media Player',
theme: ThemeData.dark(),
home: const MediaPlayerScreen(),
debugShowCheckedModeBanner: false,
);
}
}
class MediaPlayerScreen extends StatefulWidget {
const MediaPlayerScreen({super.key});
@override
State<MediaPlayerScreen> createState() => _MediaPlayerScreenState();
}
class _MediaPlayerScreenState extends State<MediaPlayerScreen> {
late OfflineMediaPlayer _player;
@override
void initState() {
super.initState();
final playlist = [
MediaItem(
filePath: "C:/Users/Sarvesh/Videos/sample_video.mp4",
isVideo: true,
subtitlePath: "C:/Users/Sarvesh/Videos/sample.srt",
),
MediaItem(
filePath: "C:/Users/Sarvesh/Music/sample_audio.mp3",
isVideo: false,
),
];
_player = OfflineMediaPlayer(playlist: playlist);
_player.play();
}
@override
void dispose() {
_player.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
final currentFile = _player.current.filePath.split(Platform.pathSeparator).last;
return Scaffold(
appBar: AppBar(title: const Text('Offline Media Player')),
body: Column(
children: [
Expanded(
child: Center(
child: _player.current.isVideo && _player.chewieController != null
? AspectRatio(
aspectRatio: _player.chewieController!.videoPlayerController.value.aspectRatio,
child: Chewie(controller: _player.chewieController!),
)
: const Icon(Icons.audiotrack, size: 150, color: Colors.blueAccent),
),
),
Text("Now Playing: $currentFile", style: const TextStyle(fontSize: 18)),
],
),
);
}
}
Screenshots #
- [Example Video Player]
About Me #
⨠Iām Sufyan bin Uzayr, an open-source developer passionate about building and sharing meaningful projects. You can learn more about me and my work at sufyanism.com or connect with me on Linkedin
Your all-in-one no-bloat hub! #
š Explore cutting-edge resources in coding, tech, and development at zeba.academy and code.zeba.academy. Empower yourself with practical skills through curated directives, real-world projects, and hands-on experience. Level up your tech game today! š»āØ
Zeba Academy is a learning platform dedicated to coding, technology, and development. ā” Visit our main site: zeba.academy ā” Explore hands-on courses and resources at: code.zeba.academy ā” Check out our YouTube for more tutorials: zeba.academy ā” Follow us on Instagram: zeba.academy
Thank you for visiting!
