You can use trigger App Task Ended, put Chrome. Then use action perfom click the button at the notification to play again after being paused. This method should work with any app that provide the button in the notification bar.
But special case for chrome, it support media session. We can detect the media session changed, and then send back the command to play it again after being paused. I have made the flow for it.
Chrome Continue Audio Background
- Chrome Continue Audo SS.png (57.49 KiB) Viewed 6843 times
- The flow has 2 triggers : Media Session Change by Chrome and another shortcut to play/pause. Add the shortcut to home screen.
- Flow continue to separate the trigger. If it comes from media session change by chrome, then continue to check if chrome is running.
- If Chrome is not running, then the media session changed must have been triggered by pressing home, hence Chrome not running and paused the video.
- False (chrome is not running), send back command to play again to the Chrome.
- Show notif that Playback continue
- Sleep for 1 seconds, this is to protect the flow from being retriggered. You might need to increase this if the shortcut is play/pause looping.
By enabling this flow, once you have press home, the video playback automatically resume. But there is some delay, before the event dispatched to Automagic. 1 seconds stutter should be OK, since it automatically resume. But you can't never tap the pause button in the notification bar anymore. Since it will trigger the flow again, check chrome is not running, and send play again. This mean you never can pause anymore if chrome is not running.
So I made the second shortcut, which allow you to press this, then bypass the chrome checking and send pause to chrome. But this will trigger media session change. That's why I have to use FEP : Skip, with sleep 1s to protect from retrigger after sendng pause. Pressing the shortcut again will play again the video in the background.
If you pause the video when chrome is running, this flow still triggered, but not continue to send play to Chrome. Because chrome is running. So no intervention done when you are enjoying the video as usual.