OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Sound in browser cuts off audio that is playing in the background

  • Thread starter Thread starter Mike K
  • Start date Start date
M

Mike K

Guest
In my app, we have an Audio element and when a message is received, we invoke play.

Everything works as expected. However in the case that there is music playing in the background, such as Spotify or YouTube, then it gets paused. Is there any way to invoke play "passively"?

I know that it's possible on mobile (Expo), but how can I achieve this in the background? I've looked every where, there doesn't seem to be a definitive answer, and the HMTL Audio API doesn't seem to have such a configuration.

<p>In my app, we have an <code>Audio</code> element and when a message is received, we invoke <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/play" rel="nofollow noreferrer"><code>play</code></a>.</p>
<p>Everything works as expected. However in the case that there is music playing in the background, such as Spotify or YouTube, then it gets paused. Is there any way to invoke <code>play</code> "passively"?</p>
<p>I know that it's possible on mobile (Expo), but how can I achieve this in the background? I've looked every where, there doesn't seem to be a definitive answer, and the HMTL Audio API doesn't seem to have such a configuration.</p>
 

Latest posts

P
Replies
0
Views
1
Paras Chouhan
P
Top