Jump to content

Is there a pause all alfred workflow?


Recommended Posts

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
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 by deanishe
Link to comment
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 by vitor
Link to comment

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.

1960266732_ScreenShot2021-11-21at3_39_05PM.png.4acb503505fd319d18c9c388a06b4862.png

Link to comment

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

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

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

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
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
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
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.

 

Rljh3Vz.png

Link to comment
  • 1 month later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...