Play Library untuk memutar video dan audio cross platform dengan mudah hanya menambah code pada dart, example sudah ada di
- 🚀 Cross platform: mobile, desktop
- ⚡ 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)
- Easy Play Video and Audio
- Custom View Audio And Video
- Realtime Player Like (call, streaming)
- Custom Encoding & Decoding Audio & Video
add library in first dart file
import 'package:play/play.dart';
add this in main function
void main() async {
---
await playInitialize();
---
}
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(
videoData: VideoData.file(
file: File(path),
),
isAutoStart: false,
builder: (BuildContext context, Widget child, Video video, VideoState videoState, VideoController videoController) {
return child;
}
);
---
)
If there is an error like this
Because no versions of file_picker match >5.2.3 <6.0.0 and file_picker 5.2.3 depends on ffi ^2.0.1, file_picker ^5.2.3 requires ffi ^2.0.1.
Because dart_vlc_ffi 0.1.8 depends on ffi ^1.0.0 and no versions of dart_vlc_ffi match >=0.1.7 <0.1.8-∞ or >0.1.8 <0.2.0, dart_vlc_ffi ^0.1.7 requires ffi ^1.0.0.
Thus, file_picker ^5.2.3 is incompatible with dart_vlc_ffi ^0.1.7.
And because dart_vlc 0.3.0 depends on dart_vlc_ffi ^0.1.7, file_picker ^5.2.3 is incompatible with dart_vlc 0.3.0.
Because every version of play from path depends on dart_vlc ^0.3.0 and no versions of dart_vlc match >0.3.0 <0.4.0, every version of play from path requires dart_vlc 0.3.0.
Thus, file_picker ^5.2.3 is incompatible with play from path.
So, because example depends on both play from path and file_picker ^5.2.3, version solving failed.
pub get failed (1; So, because example depends on both play from path and file_picker ^5.2.3, version solving failed.)
add the library that the example needs in pubspec.yaml
---
dependency_overrides:
ffi: 2.0.1
---
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(
videoData: VideoData.file(
file: File(path),
),
isAutoStart: false,
builder: (BuildContext context, Widget child, Video video, VideoState videoState, VideoController videoController) {
/// custom view
return child;
}
);
)
- videoData
- file
VideoData.file( file: File("./path_to_video.mp4"), )
- asset
VideoData.asset( asset: "assets/videos/video.mp4", )
- network
VideoData.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)