Giter Site home page Giter Site logo

Comments (2)

E-Kuerschner avatar E-Kuerschner commented on June 3, 2024

@AlesSrsen interesting use case, but this makes sense to me. It sounds almost like a good case for useGlobalAudioPlayer but as you mentioned this only supports one sound. Perhaps we could update the API to allow for multiple global sounds to be created/started? What do you think?

Also, I won't have as much bandwidth as I had earlier this year. If this is something you're open to collabing on in the form of a PR, feel free to get started on one or starting a back and forth here where we can at least discuss the solution options.

from useaudioplayer.

AlesSrsen avatar AlesSrsen commented on June 3, 2024

@E-Kuerschner I actualy did something different in the end. It is not the best practice but I created a new Audio object in the global scope, that I control with a custom hook.

But your idea of adding the ability to load more global sounds pretty smart. I might look into your source and come up with a PR if I have some free time.

The sounds will have to be probably keyed in some way as to be able to choose which one should the hook return.


But back to the initial idea, don't you think, that this could be added by checking whether the sound is playing during unmount and adding an event listener on ended to destory the howl? Or are you against this kind of rule bending?

from useaudioplayer.

Related Issues (20)

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.