Stopping Audio Playback on Tab Navigation or Modal Dismissal in Hotwire Native

I’m building a Hotwire Native iOS app using a TabBarController setup inspired by Joe’s Hotwire Book. One of my tabs plays audio files, and I want to stop the audio when the user navigates to another tab or closes a modal view (e.g., a modal opened from the tab). Are there any existing JavaScript events my web page can subscribe to for detecting these navigation changes?

I noticed that BridgeDelegate has methods like onViewWillDisappear, which suggests I could create a custom bridge component to send a message to the web page when the tab or modal is about to disappear, allowing me to stop the audio. Is this the recommended approach, or are there built-in events I can use instead?

I’m reading into the HotwireWebViewController and we have all the viewLifeCycle events here like viewWillDisappear. It sends these signals to BridgeComponents and I’m curious why we don’t do the same for pure Stimilus JS controllers?