kplayer 0.1.18 kplayer: ^0.1.18 copied to clipboard
audio player that support all platforms.
kplayer #
Flutter player (currently only audio)
sopport #
- windows,linux -> dart_vlc
- web, ios, android, macos -> just_audio
this package is just wrapper for just_audio and dart_vlc to support all platformsthis packege is just wrapper forjust_audio
and dart_vlc
to support all platforms
Getting Started #
for specific platform configuration visit just_audio
and dart_vlc
main.dart
void main() {
Player.boot(); //add this line
runApp(MyApp());
}
Play from assets:
var player = Player.asset("/assets/sound.mp3");
Play from network:
var player = Player.network("[/assets/sound.mp3](https://example.com/sound.mp3)");
Play from file:
var player = Player.file("C/.../sound.mp3");
Play from bytes: // beta
var player = Player.bytes(fileAsBytes);
or:
var player = Player.create(asset: PlayerMedia.asset("/assets/sound.mp3"), autoPlay: true, once: true)
..init()
you have also:
var palyer = Player.create(asset: PlayerMedia.asset("/assets/sound.mp3"),autoPlay: true, once: true)..init();
// callback
palyer.callback = (PlayerEvent event){
// just example
setState((){});
};
// info
var package = player.package; // "just_audio" or "dart_vlc"
var position = player.position; // setter an getter like seek()
var duration = player.duration; // getter
var status = player.status; //
var loop = player.loop; // bool
var playing = player.playing;
...
// streams
player.streams.playing.stream;
player.streams.position.stream;
player.streams.status.stream;
player.streams.volume.stream;
player.streams.speed.stream;
player.streams.loop.stream;
// control
player.play();
player.pause();
player.toggle();
player.stop();
player.seek(newPosition);
player.volume = 0.8; // setter getter
player.speed = 1.2; // Rate
player.loop = true; // looping
//other
player.dispose();
player.player; // the package player instance for more option
// Widgets
PlayerBar(player: player, options: []);
PlayerBuilder(player: player, builder: (context, player, event){
return // TODO
});
// mixins PlayerMixin
## Source code
check the repository on github (<https://github.com/physia/kflutter/tree/main/kplayer/kplayer>)
## Support ☺️
you can buy me a coffee.
<a href="https://www.buymeacoffee.com/mohamadlounnas"><img src="https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=mohamadlounnas&button_colour=FFDD00&font_colour=000000&font_family=Cookie&outline_colour=000000&coffee_colour=ffffff"></a>
E n g o j :)
next plan: sopport video...