Play Library untuk memutar video dan audio cross platform dengan mudah hanya menambah code pada dart, example sudah ada di
- 🚀 Cross platform: mobile, desktop, web, cli
- ⚡ Great performance
- ❤️ Simple, powerful, & intuitive API
2022-11-27.02-30-24.mp4
2022-11-27.02-34-32.mp4
dart pub add play
flutter pub add play
- Cross platform support (Android,iOS, Linux, Windows, Web)
- Easy Play Video and Audio
- Custom View Audio And Video
- Realtime Player Like (call, streaming)
- Custom Encoding & Decoding Audio & Video
OS | Tested |
---|---|
Android | Tested |
Linux | Tested |
Windows | Tested |
ios | Tested |
Web | Tested |
macOS | Not Tested |
add library in first dart file
import 'package:play/play.dart';
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
I use 3 libraries so your document can be seen here
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
pause
play
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
seek(Duration())
playOrPause
isPlaying
pause
play
size
aspectRatio
setPlaybackSpeed(1.5)
setVolume(0.5)