green-audio-player | Audio Player javascript library | Media Player library

 by   greghub JavaScript Version: 1.1.2 License: MIT

kandi X-RAY | green-audio-player Summary

kandi X-RAY | green-audio-player Summary

green-audio-player is a JavaScript library typically used in Media, Media Player, React, Unity applications. green-audio-player has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can install using 'npm i green-audio-player' or download it from GitHub, npm.

Based on a pen I've created 2 years ago. Due to requests from many people I decided to create a repository, containing an improved version of the Green Audio Player including the support for multiple audio players on a single page.

            kandi-support Support

              green-audio-player has a low active ecosystem.
              It has 206 star(s) with 51 fork(s). There are 3 watchers for this library.
              It had no major release in the last 12 months.
              There are 15 open issues and 19 have been closed. On average issues are closed in 54 days. There are 14 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of green-audio-player is 1.1.2

            kandi-Quality Quality

              green-audio-player has 0 bugs and 0 code smells.

            kandi-Security Security

              green-audio-player has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              green-audio-player code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              green-audio-player is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              green-audio-player releases are not available. You will need to build from source code and install.
              Deployable package is available in npm.
              Installation instructions, examples and code snippets are available.
              green-audio-player saves you 203 person hours of effort in developing the same functionality from scratch.
              It has 498 lines of code, 0 functions and 9 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed green-audio-player and discovered the below as its top functions. This is intended to give you an instant insight into green-audio-player implemented functionality, and help decide if they suit your requirements.
            • New AudioPlayer class .
            • run require function
            • exec a module
            • Turns an array of items into an array .
            • Represents a non - iterable state .
            • Copy iterator to array
            • Replaces all holes in an array with an array .
            • Call a constructor
            • Define properties on an object
            • Creates a new class .
            Get all kandi verified functions for this library.

            green-audio-player Key Features

            No Key Features are available at this moment for green-audio-player.

            green-audio-player Examples and Code Snippets

            No Code Snippets are available at this moment for green-audio-player.

            Community Discussions


            Javafx MediaPlayer runs into error whenever you disconnect bluetooth headphones
            Asked 2022-Apr-12 at 01:12

            I have a highschool capstone where I must create a music player which plays music. However, whenever I connect my bluetooth headphones(airpods or musicozy) and then disconnect them, the MediaPlayer halts and an error is produced. I've searched on the internet for an answer but am unable to find one. If someone could help me that would be great! I'm using Javafx 17.0.2 and JDK 11.

            Here's a mini reproducible example below.

            JavaFxMediaPlayer ...


            Answered 2022-Apr-12 at 01:12

            The problem with your recovery is that you are seeking too soon. The docs for seek state that it does nothing while the media player is stopped, but you aren't waiting for the state to change after calling play().

            Try this:



            React Manage Multiple Audios on Same Page and play one at a time using function based components
            Asked 2022-Apr-01 at 17:55

            I am making a new react app which have multiple music cards on same page. I want to change the state of previous card before updating the state of new card. In short I want to pause previous audio before playing new one.



            Answered 2022-Apr-01 at 17:55

            Make a common state in parent storing active playing: const [activePlaying,setActivePlaying]=useState(null);

            Make a handler for it:



            Android Music player in Kotlin
            Asked 2022-Mar-24 at 11:57

            I have developed a music player app in kotlin language. At present when I start another app's song, my app's song is also playing. both songs are playing simultaneously. I would like to add a functionality where the song should stop automatically when another app's media (audio/video) starts playing. How to add this functionality. What concept is behind it? Any hint or suggestion would be appreciated. thanks



            Answered 2022-Mar-24 at 11:57

            You can take a look at this Documentation, where you will be given the option to add listener in the AudioFocusRequest Builder to listen to Audio Focus Event and add your callback there. alternatively ExoPlayer Library gives you the option to handle Audio Focus automatically on setAudioAttributes method on its Player implementation



            Unable to delete .mp3 file due to javaFx MediaPlayer
            Asked 2022-Mar-20 at 00:05

            I am working on my Hhighschool capstone. It is a program where the user can download songs from the internet and store them in an organized manner and play them. My program must contain a feature where the user may delete a specified .mp3 file by simply pressing a button. I have tried the .dispose() method on the MediaPlayer, and then trying to delete the file which doesn't seem to be working. It creates an error saying that the .mp3 file is still being used. How would I stop Javafx from accessing the file? I have searched online for answers but none of them have answers which fit my needs. If anyone could provide me with some code to fix my problem that would be greatly appreciated! Here's a Mini Reproducible Example below!

            JavaFxMp3WavPlayer ...


            Answered 2022-Mar-20 at 00:05

            Thank you to @Slaw for providing a solution to my problem. To solve my issue, I created a deletionQueue ArrayList which would hold the paths to the files I would like to delete. Once .dispose() is used on the MediaPlayer, after a certain amount of time has passed, those files would be automatically deleted.



            JavaFX MediaPlayer import
            Asked 2022-Mar-14 at 10:43

            I have a issue, not being able to import MediaPlayer in my JavaFX project. I am using IntelliJ with a Maven build, JDK 17 .. I updated the Maven dependencies and I have the JavaFX plugin installed, and it is still not working.. Thanks in advance for any answer/suggestion



            Answered 2022-Mar-14 at 10:43

            If you define a file and you want to use the module, you need to require that module in your module-info (as suggested by kleopatra in comments).



            How do I make a media player control notification in Gtk?
            Asked 2022-Mar-09 at 21:39

            In Rhythmbox (GNOME's music player), when it's playing music, you can open the notifications panel and control the music playback from there. Here's a screenshot. The playback controls are bordered in orange; they have a little music note icon:

            This is what I want to make; the media playback controls. Note that, while it is in the notifications panel, it's not technically a notification, because it never pops up on the screen, and you can't make it go away. In the screenshot, you can see the actual notification, which I don't want to make, below the controls.

            I know that there's a Gio.Notification, but it's not quite what I need (unless I'm very much mistaken). I searched in Gio, Gdk, and Gtk, but I didn't find anything. I also searched, among other things, [gtk] media control and [gtk] media notification on Stack Overflow, but I didn't find anything there either.

            Thanks to the help of BobMorane, I've now figured out that Rhythmbox uses libnotify for its player controls. I know how to create actions using Notify.Notification, and I can make them have images, etc., but what I still haven't figured out is how to:

            1. Make the notification so that it can't be closed;
            2. Make it so that the action buttons are next to the icon and text, not under;
            3. Keep the notification on top of all the others in the notifications panel.

            Using Python's help() function to look at gi.repository.Notify.Notification, the only methods I see that seem to have potential are add_action() (particularly its user_data parameter) and set_hint() (and its variants). Could these be used to achieve my goal?

            How do I make a media-control "notification" in Gtk with Python, as explained above?



            Answered 2022-Mar-09 at 21:22

            I think the technology used by Rhytmbox to acheive this is MPRIS (Media Player Remote Interfacing Specification). As they say on their we page:

            The Media Player Remote Interfacing Specification (MPRIS) is a standard D-Bus interface which aims to provide a common programmatic API for controlling media players.

            It provides a mechanism for discovery, querying and basic playback control of compliant media players, as well as a tracklist interface which is used to add context to the active media item.

            In Rhythmbox, this is implemented as a core plug-in. The code is pretty complicated, but basically implements the MPRIS specification. This implementation then exposes some information and controls out to other applications which want to control the Rhythmbox, like the Gnome Shell in your case. If you deactivate the MPRIS plug-in, the "notification player" will no longer work.

            In GNOME Shell, you can see they have their own MPRIS module as well (, which is used to:

            1. Respond to player notifications and display information (album art, title, buttons, etc).
            2. Send notifications to the player (ex.: pause the song).

            In this module, the formatting of the buttons and all that stuff comes into life as well. This means that on your part (the player's designer), you should have no UI formatting to do (you don't have control over this, GNOME Shell has). What you need to do is expose what is needed by the GNOME Shell by implementing the MPRIS interfaces.

            (As a side note: the calendar.js file is the one implementing the notification list, and you can see it uses MPRIS "notifications", which it puts on top of standard notifications.)

            There exist Python libraries to do so, such as Mopidy-MPRIS, bit their support for the GNOME Shell seems not to be working at the moment. You may have to look for D-Bus related libraries on There exists many bindings, with some in Python.

            I hope this points you in the right direction.



            Can't play wav or mp3 files with Javafx MediaPlayer. Also can't play wav files with the native java library
            Asked 2022-Feb-13 at 09:17

            I have a java project where I have to make a music player that plays either wav or mp3 files. However I can't get my wav or mp3 files to play using the Javafx libraries or with native java libraries. I've checked and made sure the wav and mp3 files I'm using to test aren't corrupted. I'm using Javafx 17.0.2 and JDK 11.

            Mini Reproducible Example With Javafx JavaFxMp3WavPlayer ...


            Answered 2022-Feb-13 at 09:17

            I could not reproduce your issue.

            Your issue is environmental, exactly what it is I could not say.

            I advise creating a new project in idea and following the same steps I did and it should work as long as you have the file path correct.

            These are the steps I followed to get allow the media to play with your sample app:

            1. Created a new JavaFX project in Idea with OpenJDK 17.0.2 and JavaFX 17.0.2 on Windows 11.

            2. Copy-and-pasted your JavaFX sample code into the new project.

            3. Followed the instructions to add media handling to the project:

            4. Downloaded your mp3 and wav files.

            5. Set the file path to each in turn.

            6. Ran the app and hit the play button for each file.

            Both the MP3 and WAV files played without problem.

            Your lie in april is nice, I will try to learn it.



            Is it possible to create a browser based html/javascript audio player, that handles most of the MPRIS commands?
            Asked 2022-Feb-12 at 09:09

            I am trying to create a music player, that can handle most of the MPRIS commands.

            During youtube is playing, playerctl list the firefox player (firefox.instance{id}), and if it has playlist then I can skip to previous / next item using $ playerctl -p firefox.instance{id} next. This works in chrome too.

            I want to implement the same behavior in a React.js application, but first I'm looking for a html/javascript based solution.

            One of my guesses that this is impossible (without using a browser add-on), because firefox implements this manually for each supported website.

            Maybe I did something wrong, but no matter what I search for I couldn't find any information about this.

            Thanks for reading / commenting!



            Answered 2022-Feb-12 at 09:09

            Media Session API seems to solve this problem pretty well:

            This event listener runs every time $ playerctl -p firefox.instance{id} next is run (or when any other MPRIS client calls 'next', like KDE connect on android):



            How to play audio continuously in xamarin forms
            Asked 2022-Feb-11 at 08:46

            I implemented audio implementation and added looping property also. But the audio Plays a two times only and after that audio doesn't play. Here I attached a code I implemented. Kindly help how to fix. Thanks for advance



            Answered 2022-Feb-11 at 08:46

            For Android

            You need a hook way to implement a loopMediaPlayer, that is creating a new player when the audio is finished.

            Refer to : .

            For iOS

            Due to ARC , probably AVAudioPlayer is released after calling dependency service , to solved it you can try to make _player as global variable .

            Refer to .



            Godot: Rename application name used by file explorer in "open with" menu
            Asked 2022-Jan-11 at 17:52

            I'm creating a media player using Godot. The application is already able to play .mp3 files by using the open with option in the file explorer. The name of the project is "Media player" and the executable is called "Media Player.exe" yet when presented in the open with menu it is displayed as "Godot Engine".

            So my question: Is it possible to change this? If so, how?

            Note: The option is only visible after first opening a .mp3 file by manually navigating to the executable. The .mp3 file is thus not opened with the Godot game engine but by an application made with it.

            Here is an example.



            Answered 2022-Jan-11 at 16:24

            Found the solution.

            By editing the .exe file using resourcehacker you can adjust the file description and icon. By editing the product name will give the correct name.

            Thanks to cybereality from the Godot forum to enlighten me on this solution.


            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install green-audio-player

            Alternatively, you can load it from CDN:.


            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
          • npm

            npm i green-audio-player

          • CLONE
          • HTTPS


          • CLI

            gh repo clone greghub/green-audio-player

          • sshUrl


          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link