Activate vibration api on meteor react web app


#1

Hi,

It seems that is impossible to run sound on mobile browser without interaction with the user; so my second option to alert the user who use his phone to explore my web app, is to activate the vibration api.

my question is: is it possible to activate vibration on phone browser?? and how, if yes ??

Have you any solution to set a sound alert or vibration or similaire ??

Thank’s


#2

You don’t have access to native functionality of a device when accessing a web app through the browser, so there’s no current way to use the vibration functionality of a mobile device.

If this is necessary the only option is to package your app into a mobile app with cordova and use a plugin that exposes the vibration functionality (https://github.com/apache/cordova-plugin-vibration).

What is the problem with playing sounds through the browser you’re having?


#3

@nlammertyn the problem is that the sound doesnot play when you use your phone browser, i test it on desktop, it does work but on my android chrome does not. Based on what i read, Android and iOS does not allow play sound if the user was not who does the action. In my case i want to implémenté reminder, so without intercation with the user . Have you some suggestions ?


#4

I know howler has some functionality that tries to circumvent that, but not sure if it actually works, you could try it out. Otherwise there’s no way around it, you could show a button when the page opens that allows sound to be played, but not without user interaction.


#5

@nlammertyn, I give it a try, really I dont figure out how do it with it, and I cant stop the sound on click the button after playing.
thanks