MohammadAzeem asked this on 2025-03-15
In a web application what are the ways one can use custom audio file for notification on user devices while the user is offline.
Running audio in background while still offlineThe Call Kent podcast is a regular podcast where you call in with a question and Kent answers. Call in with your questions right from your web browser with any device at https://kentcdodds.com/call
You're listening to the Call Kent podcast where Kent C. Dodds answers questions and gives insights to software engineers like you. Now let's hear the call.
Mohammad:Hey, Kent. My name is Mohammad Azim. Greetings, first of all. I was building a prayer time application, and I came around the situation where I have to do a prayer call on the user end device. So is there any way that I can run audio files in background of web application by using some service worker while the user is still offline And the and the precise timing precise timing of the prayer call is essential for this.
Mohammad:So thanks in anticipation.
Narrator:And that was the call. Here's what Kent had to say.
Kent:Hey, Mohammad Amzim. Thank you for the question. I unfortunately don't have a ton of experience with this specifically, so I'm not gonna be able to give you a lot of help, but I can give you some direction on what I would try if I had this sort of use case. Really, the first thing I would do is ask AI to give me some specific things that I can look up. Even just asking AI, is this a thing that can be done?
Kent:Can be a really useful question, and I'm pretty sure that the answer is yes. You should be able to cache audio files in the service worker, and then serve those from the service worker as well. So I think that you're on the right track to give this a shot, And then hopefully, AI can help you make that happen. Of course, like, you could code it up the way that we used to back in the good old days before AI, where you're looking up the documentation on MDN and that sort of thing. But I think that AI will get you there a lot faster.
Kent:So give that a try. I hope that it's helpful to you, and I hope you have a nice day.
Narrator:This has been the Call Kent podcast. Learn more about Kent at Kent C Dodds dot com and get your own questions answered at KentCDodds.com/calls.