How To Play Sound In Browser Using Howler (React Tutorial)

Поділитися
Вставка
  • Опубліковано 18 вер 2024
  • I am now on Twitter: alfiewebdev
    Hello all,
    In this video I show you the basics of React Howler, an npm package which allows you to easily play sound in the browser using only a few lines of code. I go over how to play and pause an MP3 file as well as how to preload the file to cut down on loading times when a user wants to hear the sound, thus creating a better user experience. If you have any questions or constructive criticism, please leave it down in the comment section below and I'll get back to you as soon as I can. Thanks for watching my video!

КОМЕНТАРІ • 31

  • @Ksys
    @Ksys 2 роки тому +1

    Thank you for this short and easy to understand video!

  • @jeremiahthompson82
    @jeremiahthompson82 Рік тому

    Thanks so much. Fantastic tutorial

  • @oscargalvez7
    @oscargalvez7 2 роки тому +1

    Thanks for the tutorial, it was just what I needed! Keep up the amazing content! 🔥🔥🔥

  • @denniscao8292
    @denniscao8292 2 роки тому +1

    Thanks for the tutorial, it worked for me.

  • @johnstevengonzalez2394
    @johnstevengonzalez2394 2 роки тому

    Thanks for everything men! Your tuto helps me

    • @AlfieWebDev
      @AlfieWebDev  2 роки тому +1

      No worries man. If you have any tutorial requests, please let me know. Thanks for viewing!

  • @AlfieWebDev
    @AlfieWebDev  2 роки тому

    I'm thankful for all the positive feedback on the video. If you have any tutorial requests, please feel free to let me know. :)

  • @ArjunSingh-pm2vt
    @ArjunSingh-pm2vt 2 роки тому

    Very helpful...love you Man

  • @davidgallego1216
    @davidgallego1216 2 роки тому

    Amazing!. This help me.

    • @AlfieWebDev
      @AlfieWebDev  Рік тому

      Fantastic. Happy to hear it helped you

  • @GAGANDEEP901
    @GAGANDEEP901 2 роки тому +2

    hey great video, i have a query, how to play file from local folder?

    • @fattchong1619
      @fattchong1619 2 роки тому +1

      debes poner la carpeta con el audio en la carpeta public

    • @rotaikorailgun3261
      @rotaikorailgun3261 2 роки тому

      @@fattchong1619 hola amigo, lo pudiste hacer de esa forma? Cómo linkeaste a los archivos desde la App.js teniendo los mp3 en la carpeta public? Tuviste que agregar los mp3 al webpack? Gracias

    • @fattchong1619
      @fattchong1619 2 роки тому +1

      @@rotaikorailgun3261 como lo puse en el comentario anterior me resulto

    • @rotaikorailgun3261
      @rotaikorailgun3261 2 роки тому

      @@fattchong1619 si, lo pude resolver por suerte. En el src se accede como si fuese desde el html principal

    • @ozoindaprince
      @ozoindaprince Рік тому

      import audio from "/path/to/file"; src:[audio]

  • @ozoindaprince
    @ozoindaprince Рік тому

    the pause function does not work 😥

  • @fazliddinfayziyev8072
    @fazliddinfayziyev8072 Рік тому

    Thank you bro. I liked it

    • @AlfieWebDev
      @AlfieWebDev  Рік тому

      Glad to hear that, Thanks for your comment

  • @bravefart651
    @bravefart651 2 роки тому

    Cool vid. I have a folder with lots of mp3's, how do i get my game to play random sounds when i hit the Enter key? Same button but changing the sound each time rather than the same one all the time

    • @AlfieWebDev
      @AlfieWebDev  2 роки тому

      Hey! Did you figure it out? If not, feel free to link a repo and I'll help out

    • @bravefart651
      @bravefart651 2 роки тому

      @@AlfieWebDev No man, gave up, didn't have the time or patience.. or the brains apparently 😂

    • @AlfieWebDev
      @AlfieWebDev  2 роки тому

      @@bravefart651 Ahh sorry to hear that. My offer is open in the case that you decide to go back to it!

  • @michaelurner3601
    @michaelurner3601 2 роки тому

    For some reason onClick is undefined. This may be a rudimentary question, but how do I define it?

    • @AlfieWebDev
      @AlfieWebDev  2 роки тому

      Sorry for my late reply. If you still have this problem, please feel free to share your code and I will help you out.

    • @michaelurner3601
      @michaelurner3601 2 роки тому

      @@AlfieWebDev Thank you for the reply. I figured it out.

  • @mayank_singh_43
    @mayank_singh_43 2 роки тому

    It is showing me error that howl is not a constructer

    • @AlfieWebDev
      @AlfieWebDev  2 роки тому

      Did you solve the problem? If not, you can show me your code and I will see if I can help.

    • @nenadnovovic9697
      @nenadnovovic9697 2 роки тому

      Got the same issue when trying to import from 'react-howler'.
      So, change " import { Howl } from react-'howler'" to "import { Howl } from 'howler' ";