Web App play audio problem

Hello everyone

I have a Web application that plays audio from an html audio tag. Is there any way to find out that some other application will start playing audio on the MEDIA channel? My problem is that when my app plays audio in the background and another app starts playing audio (such as Samsung Health), my audio pauses and doesn’t start playing again. I’ve tried both the EventListener function and the timeout function, but it only works partially and the application often crashes. Can anyone please advise? Thank you.

Be honest I have not found any system audio events for web app. Maybe someone had more luck.
So the best way is to listen for system audio events but you can do it only in native c app. You will have to create native service which listens for audio events and send them to web app by message port.

Look at audio_in_set_interrupted_cb(input, _audio_io_interrupt_cb, NULL)
Read here https://docs.tizen.org/application/native/api/wearable/2.3.1/group__CAPI__MEDIA__AUDIO__IO__MODULE.html

and read about using message port here: https://docs.tizen.org/application/web/guides/app-management/message-port

The 2nd drawback using web audio playing is limitation to one sound at the time.

Thank you very much Andrzej for your answer.
I will try create some native service.

You are welcome :slight_smile: