Play library
Fast, Enjoyable & Customizable Play library
Play Library untuk memutar video dan audio cross platform dengan mudah hanya menambah code pada dart, example sudah ada di
Features
- 🚀 Cross platform: mobile, desktop, web, cli
- ⚡ Great performance
- ❤️ Simple, powerful, & intuitive API
Demo
Install Library
dart pub add play
flutter pub add play
To-Do
x
Cross platform support (Android,iOS, Linux, Windows, Web)x
Easy Play Video and Audiox
Custom View Audio And Videox
Realtime Player Like (call, streaming)
Tested On
OS | Tested |
---|---|
Android | Tested |
Linux | Tested |
Windows | Tested |
ios | Tested |
Web | Tested |
macOS | Not Tested |
Quickstart
add library in first dart file
import 'package:play/play.dart';
Flutter
import 'package:flutter/material.dart';
import 'package:play/play.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
Play.ensureInitialized();
/// --- your code
/// return runApp(
/// const MaterialApp(home: MainPage()),
///);
}
Audio Player
Scaffold(
---
Audio(
audioData: AudioData.file(
file: File(path),
),
isAutoStart: false,
builder: (BuildContext context, Widget child, Audio audio, AudioState audioState,AudioController audioController) {
return child;
}
);
---
)
Video Player
Scaffold(
---
Video(
mediaData: MediaData.file(
file: File(path),
),
isAutoStart: false,
builder: (BuildContext context, Widget child, Video video, VideoState videoState, MediaController mediaController) {
return child;
}
);
---
)
I don't have enough native coding skills so I can't add many features in this library, if you want to contribute please just add it I'll be happy if you help me
Docs
I use 3 libraries so your document can be seen here
Audio
Documentation audio
- AudioData
- file
AudioData.file( file: File("./path_to_audio.mp3"), )
- asset
AudioData.asset( asset: "assets/audio/audio.mp3", )
- network
AudioData.network( url: "https://example.com/example.mp3", )
-
isAutoStart
true
if you want auto play set data to truefalse
if you don't want auto play set data to true
-
id
- int If you want to play a lot of media, add the IDs in the order of the videos / don't have the same ones
-
builder
AudioController
pause
play
Video
Documentation video
Scaffold(
child: Video(
mediaData: MediaData.file(
file: File(path),
),
isAutoStart: false,
builder: (BuildContext context, Widget child, Video video, VideoState videoState, MediaController mediaController) {
/// custom view
return child;
}
);
)
- mediaData
- file
MediaData.file( file: File("./path_to_video.mp4"), )
- asset
MediaData.asset( asset: "assets/videos/video.mp4", )
- network
MediaData.network( url: "https://example.com/example.mp4", )
-
isAutoStart
true
if you want auto play set data to truefalse
if you don't want auto play set data to true
-
id
- int If you want to play a lot of media, add the IDs in the order of the videos / don't have the same ones
-
builder
MediaController
seek(Duration())
playOrPause
isPlaying
pause
play
size
aspectRatio
setPlaybackSpeed(1.5)
setVolume(0.5)