Kelson01 Posted November 21, 2021 Share Posted November 21, 2021 I'm looking for an alfred workflow that would pause all audio/video. Pause spotify, youtube and more all at once. Sometimes when I open my browser there's several videos that autoplay at once and I'd like to just pause them all quickly without having to manually do it. Sure, I could just disable autoplay on youtube but that would be inconvenient more times than it would help. Does something like this already exist? Link to comment
deanishe Posted November 21, 2021 Share Posted November 21, 2021 (edited) 4 hours ago, Undertaker01 said: Sure, I could just disable autoplay on youtube but that would be inconvenient more times than it would help. You don't have many other options, tbh. Your media keys will probably work for one application playing audio/video, but that’s it. There is no universal method for discovering which apps are playing something, nor for telling them to stop. Some apps might support the requisite events, others might have an AppleScript (or other API). Realistically, you're going to need a lot of application-specific code for each of the apps you want to support (if it's possible at all). The menubar app BackgroundMusic can pause some of the players you're talking about. As far as your browser goes, if you're talking about Firefox or something Chromium-based, you'd probably have more luck searching for browser extensions. Edited November 21, 2021 by deanishe Link to comment
vitor Posted November 21, 2021 Share Posted November 21, 2021 (edited) 8 hours ago, Undertaker01 said: Sometimes when I open my browser there's several videos that autoplay at once and I'd like to just pause them all quickly without having to manually do it. This seems like the most inconvenient part. If a browser extension doesn’t do it, it might be possible to cook something up with AppleScript to go through all YouTube tabs of your browser and stop the videos. This might be unreliable. 8 hours ago, Undertaker01 said: Sure, I could just disable autoplay on youtube but that would be inconvenient more times than it would help. What browser are you using? On Safari, I have YouTube set to the default “Stop Media with Sound” and it works perfectly with my mental model: it auto-plays a YouTube video if you open it on the current tab, otherwise it doesn’t. I never starts playing when I don’t want it to, and always does when I do. 4 hours ago, deanishe said: Some apps might support the requisite events, others might have an AppleScript (or other API). Realistically, you're going to need a lot of application-specific code for each of the apps you want to support (if it's possible at all). Tell me about it! To control Overcast alone, I need an insane approach where I bring it to front, fake a keypress, then dismiss it. Granted, it’s an iOS app on macOS, but the point about inconsistency stands. Edited November 21, 2021 by vitor Link to comment
Kelson01 Posted November 21, 2021 Author Share Posted November 21, 2021 Okay, I suppose that I can use Brave browser's built in function where clicking on the Icon in the top right shows all tabs that are playing audio/video. It gives options to pause them individually from there. I still don't see an option to pause everything at once, but I can live with it. For context I always have multiple browser windows open with videos I plan on watching later. I try to not have them as my focused window when I close the browser but that doesn't always work. Yes, I know a watch later playlist exists...Somehow those videos never end up getting watched. Link to comment
vitor Posted November 22, 2021 Share Posted November 22, 2021 (edited) Try this. That Wokflow will pause every audio and video element on every tab of every Brave window. Edited November 22, 2021 by vitor Link to comment
Kelson01 Posted November 23, 2021 Author Share Posted November 23, 2021 11 hours ago, vitor said: Try this. That Wokflow will pause every audio and video element on every tab of every Brave window. That didn't work for me. It does nothing when I try to run it. The only thing I can think of is that I'm still running Big Sur but I doubt that that's it. Link to comment
deanishe Posted November 23, 2021 Share Posted November 23, 2021 36 minutes ago, Undertaker01 said: The only thing I can think of Don't guess, use the debugger. Link to comment
vitor Posted November 23, 2021 Share Posted November 23, 2021 The likeliest explanation is that you haven’t enabled “Allow JavaScript from Apple Events” (or similarly named). The debugger should give a clue regarding that. The option is under one of the menus at the top. I can be more specific when I’m back at the computer. Link to comment
vitor Posted November 23, 2021 Share Posted November 23, 2021 2 hours ago, vitor said: The option is under one of the menus at the top. I can be more specific when I’m back at the computer. Specifically, it’s View → Developer → Allow JavaScript from Apple Events. Link to comment
Kelson01 Posted November 23, 2021 Author Share Posted November 23, 2021 I have enabled that setting in brave and the workflow still does nothing for me. I have tried triggering it through the keyword & hotkey. Link to comment
vitor Posted November 23, 2021 Share Posted November 23, 2021 As Dean mentioned, please use the debugger and post the output. I can’t diagnose if you don’t provide information. I need to know exactly what you’re doing. Consider a video. Also, redownload and reinstall the Workflow (same link) as I’ve made an unrelated correction. Link to comment
Kelson01 Posted November 23, 2021 Author Share Posted November 23, 2021 I get this error every time I run the workflow. It takes a couple minutes to show up each time. Link to comment
vitor Posted November 23, 2021 Share Posted November 23, 2021 That helps. Now we have something specific to diagnose. That looks like it might be waiting for you to give it permission to do it’s thing but you haven’t authorised it then it gives up waiting. Go to System Preferences → Security & Privacy → Privacy → Automation. Look for Alfred 4.app and make sure the Brave Browser.app checkbox under it is ticked. Then try again. Failing that, how many Brave windows do you have open? And (roughly) how many tabs amongst them? Also, how many instances of Brave do you have open (i.e how many Brave icons do you have in your Dock)? Link to comment
Kelson01 Posted November 23, 2021 Author Share Posted November 23, 2021 The button is already checked. The workflow works sometimes. I got it to work once but it was only pausing a single tab and did not work after that. I have hundreds of tabs open, mostly in closed tab groups, and 7 or 8 brave windows. I keep youtube videos I want to watch as open tabs because otherwise I will never get to them. This way it forces me to watch them. Most of my Brave windows are on different mission control spaces. Link to comment
vitor Posted November 23, 2021 Share Posted November 23, 2021 How about the number of Brave instances? That’s the most important, because AppleScript can’t handle multiple instances of the same app. But your setup is pretty large. I’m thinking of turning this into a proper Workflow with support for more browsers, so I should probably get to that first and then we’ll see from usage from other users if we can discover the root of the issue, because it’s not failing in my tests. Link to comment
Kelson01 Posted November 24, 2021 Author Share Posted November 24, 2021 50 minutes ago, vitor said: How about the number of Brave instances? That’s the most important, because AppleScript can’t handle multiple instances of the same app. But your setup is pretty large. I’m thinking of turning this into a proper Workflow with support for more browsers, so I should probably get to that first and then we’ll see from usage from other users if we can discover the root of the issue, because it’s not failing in my tests. Do you mean different brave profiles? At a time I typically only have one brave profile open at a time. I don't know if I understand what you mean by instances. If you're talking about separate windows of brave I normally have 8 or so. Link to comment
vitor Posted November 24, 2021 Share Posted November 24, 2021 It’s the number of Brave icons you have in your Dock. Link to comment
Kelson01 Posted November 24, 2021 Author Share Posted November 24, 2021 4 minutes ago, vitor said: It’s the number of Brave icons you have in your Dock. I still don't know what you mean by this. I have one brave icon in the dock like every application in the dock. I have one minimized brave window in the dock besides that. Do you mean how many processes in activity monitor? In activity monitor there is 48 Brave Browser Helper (Renderer) processes. Link to comment
vitor Posted November 24, 2021 Share Posted November 24, 2021 25 minutes ago, Undertaker01 said: Do you mean how many processes in activity monitor? No, I mean what I asked. 25 minutes ago, Undertaker01 said: like every application in the dock It’s possible to have more than one icon per application. In the case of Brave, by leveraging several profiles at once. Link to comment
Kelson01 Posted November 24, 2021 Author Share Posted November 24, 2021 Even with multiple profiles my brave does not do that, nor do any of my other apps. Perhaps I disabled it, I don't like that functionality. I have only one icon. Link to comment
deanishe Posted November 24, 2021 Share Posted November 24, 2021 6 hours ago, Undertaker01 said: Even with multiple profiles my brave does not do that, nor do any of my other apps It depends how you launch the application. Some people prefer to launch a new browser instance with a new profile. Link to comment
JamesHalliday Posted January 17, 2022 Share Posted January 17, 2022 I think this:https://github.com/Stillness-2/beardie would satisfy what you want. Kelson01 1 Link to comment
Kelson01 Posted January 17, 2022 Author Share Posted January 17, 2022 9 hours ago, JamesHalliday said: I think this:https://github.com/Stillness-2/beardie would satisfy what you want. That looks awesome! Thanks Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now