Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Latest commit

 

History

History
executable file
·
233 lines (181 loc) · 4.49 KB

readme.md

File metadata and controls

executable file
·
233 lines (181 loc) · 4.49 KB

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, web, cli
  • ⚡ 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, Web)
  2. Easy Play Video and Audio
  3. Custom View Audio And Video
  4. Realtime Player Like (call, streaming)
  5. Custom Encoding & Decoding Audio & Video

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

  1. video_player
  2. media_kit

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(
    mediaData: MediaData.file(
      file: File(path),
    ),
    isAutoStart: false,
    builder: (BuildContext context, Widget child, Video video, VideoState videoState, MediaController mediaController) {
      /// custom view
      return child;
    }
  );
)
  1. 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",
    )
  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

MediaController

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