Giter Site home page Giter Site logo

scrum-lab / scrumlab_volume_flutter Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 69 KB

Volume plugin to control device VOLUME for Android. Pull request for IOS implementation is welcome.

License: MIT License

Java 30.18% Objective-C 10.65% Dart 54.49% Ruby 4.68%

scrumlab_volume_flutter's Introduction

scrumlab_volume

Controll Volume in Android programatically. No IOS Implementation yet . Pull Request for ios implementation are welcome.

Streams

AudioManager.STREAM_VOICE_CALL       -> Controll IN CALL Volume
AudioManager.STREAM_SYSTEM           -> Controll SYSTEM Volume
AudioManager.STREAM_RING             -> Controll RINGER Volume
AudioManager.STREAM_MUSIC            -> Controll MEDIA Volume
AudioManager.STREAM_ALARM            -> Controll ALARM Volume
AudioManager.STREAM_NOTIFICATION     -> Controll NOTIFICATION Volume

Show and Hide System UI

ShowVolumeUI.SHOW (DEFAULT)          -> Show system volume UI while changing volume 
ShowVolumeUI.HIDE                    -> Do not show system volume UI while changing volume 

Functions and getters

Volume Buttons will affect this volume when in app

await Volume.controlVolume(AudioManager audioManager); // pass any stream as parameter

Returns maximum possible volume in integers

await Volume.getMaxVol; // returns an integer

Returns current volume level in integers

await Volume.getVol;// returns an integer

Set volume for the stream passed to controlVolume() function

await Volume.setVol(int i, {ShowVolumeUI showVolumeUI});

Max value of i is less than or equal to Volume.getMaxVol.

showVolumeUI is optional parameter which defaults to ShowVolumeUI.SHOW.

Usage

class _MyAppState extends State<MyApp> {
  int maxVol, currentVol;

  @override
  void initState() {
    super.initState();
    audioManager = AudioManager.STREAM_SYSTEM;
    initAudioStreamType();
    updateVolumes();
  }

  Future<void> initAudioStreamType() async {
    await Volume.controlVolume(AudioManager.STREAM_SYSTEM);
  }

  updateVolumes() async {
    // get Max Volume
    maxVol = await Volume.getMaxVol;
    // get Current Volume
    currentVol = await Volume.getVol;
    setState(() {});
  }

  setVol(int i) async {
    await Volume.setVol(i, showVolumeUI: ShowVolumeUI.SHOW);
    // or 
    // await Volume.setVol(i, showVolumeUI: ShowVolumeUI.HIDE);
  }
  // To implement the volume Up and volume Down button press programatically.
  

scrumlab_volume_flutter's People

Contributors

giulianojordaoscrumlab avatar

Watchers

Giuliano Jordao avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.