/play

Flutter Library For Play Video and Audio cross platform support

Primary LanguageDartMIT LicenseMIT

Play library

Fast, Enjoyable & Customizable Play library

Pub Version

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
  • ⚡ Great performance
  • ❤️ Simple, powerful, & intuitive API

Demo

2022-11-27.02-30-24.mp4
2022-11-27.02-34-32.mp4

Install Library

dart pub add play
flutter pub add play

To-Do

  1. Cross platform support (Android,iOS,Linux, Windows)
  2. Easy Play Video and Audio
  3. Custom View Audio And Video
  4. Realtime Player Like (call, streaming)
  5. Custom Encoding & Decoding Audio & Video

Quickstart

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

Docs

I use 3 libraries so your document can be seen here

  1. audioplayers
  2. video_player
  3. dart_vlc

Audio

Documentation audio

  1. 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",
    )
  1. isAutoStart

    • true if you want auto play set data to true
    • false if you don't want auto play set data to true
  2. 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
  3. builder

AudioController

  • pause
  • play

Video

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;
    }
  );
)
  1. 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",
    )
  1. isAutoStart

    • true if you want auto play set data to true
    • false if you don't want auto play set data to true
  2. 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
  3. builder

VideoController

  • seek(Duration())
  • playOrPause
  • isPlaying
  • pause
  • play
  • size
  • aspectRatio
  • setPlaybackSpeed(1.5)
  • setVolume(0.5)