Jump to content

Pause Tabs — Pause audio and video in web browser tabs


Recommended Posts

Setup


Turn on Allow JavaScript from Apple Events in the browsers you want to control. Use the Help search in the menubar to find it.


Usage


Pause audio and video in tabs of all open web browsers via the pause all keyword. pause others does the same except for the current tab. ⌘↩ makes it only pause tabs from the current browser.


pause.png


⤓ Install on the Alfred Gallery | Source

 

Edited by vitor
Link to comment

When reporting issues, please include your exact installed versions of:

  • The Workflow.
  • Alfred.
  • macOS.

In addition to:

  • The debugger output. Perform the failing action, click “Copy” on the top right and paste it here.
  • Details on what you did, what happened, and what you expected to happen. A short video of the steps with the debugger open may help to find the problem faster.

Thank you. Accurate and thorough information is crucial for a proper diagnosis which allows me to help you better.

Link to comment
  • 3 weeks later...

Apple certainly means to scare you when you enable the option:

JmdbaTG.png

Which is true. And it’s why I don’t provide warnings in the Workflow, since the browsers do it themselves. Activating the option means your browser can be controlled programatically, which is the only way this Workflow can work but it also means it opens the gates to other tools. I never heard of malware which did anything via this route, which isn’t to say it couldn’t be built.

 

Standard care about which tools you tend to run apply.

Link to comment
On 12/25/2021 at 7:57 PM, vitor said:

Update. It now also works on embedded YouTube players. Download the latest version.

Ayy! This workflow finally got made! I'm downloading it right now and we'll see if it works with all of my browser tabs!*

 

- To anyone reading this: for context it was my hundreds of youtube tabs that autoplayed that led to vitor creating this workflow...I eventually gave up and disabled autoplaying on YouTube, though I didn't want to.

 

Vitor, perhaps it's a limitation of Brave Browser, but the script appears to be timing out. I only had one video playing when I tried this each time but I still have all of my tabs. I tried every variation of triggering this workflow with the keywords and it all ended up in the same result. It didn't work for me. Am I doing something wrong?

979145068_PauseTabsNotWorking.png.d498bd3c980efbeab2f23b07eaed7024.pngbut

Link to comment
14 minutes ago, Undertaker01 said:

perhaps it's a limitation of Brave Browser

 

Unlikely. I also used it to test and all Chromium browsers have similar AppleScript.

 

I wonder what different about your setup; you seem to still be the only one to experience that and this has more users now.

Link to comment
25 minutes ago, vitor said:

 

Unlikely. I also used it to test and all Chromium browsers have similar AppleScript.

 

I wonder what different about your setup; you seem to still be the only one to experience that and this has more users now.

 

I do have 400 or so tabs open... lol. If you want I can troubleshoot with you. I'm pretty sure that I'm doing everything right. Should I have you friend me on discord?

Link to comment

I don’t use Discord and it wouldn’t be a good use of our time to diagnose four hundred individual pages when you can do the way simpler and faster solution of trying it with fewer tabs. Timeouts should happen per event, which would mean one or more of the pages could be the problem as they are not letting the necessary JavaScript run or it’s taking too long to finish for another reason. Try this version, which will output to the debugger the URL it’s trying to pause before it does it. It might give a clue.

Link to comment
16 minutes ago, vitor said:

Try this version, which will output to the debugger the URL it’s trying to pause before it does it. It might give a clue.

 

Okay! I'll save this and let you know what it does in a bit.

 

17 minutes ago, vitor said:

trying it with fewer tabs

 

Funnily enough I open about 50 new tabs daily and close about 50 old tabs. I consume a lot of content in order to learn as much as possible in a given amount of time. I've been trying my best, installing reading list extensions, adding bookmarks and watching videos at double speed...

 

I've been working at making Alfred workflows to open groups of URLS and it's on my list to organize my bookmarks so I can put them in folders.

 

Maybe there's an Alfred workflow to help manage this? Having a workflow that connects with a reading list chromium extension would be nice. Or a simpler workflow that allows you to add/remove links from it to act as a reading list within Alfred itself. OR both - I might need more than 1 workflow to have multiple reading lists!

Link to comment
On 12/29/2021 at 5:41 PM, Undertaker01 said:

Maybe there's an Alfred workflow to help manage this? Having a workflow that connects with a reading list chromium extension would be nice.

 

If you use Pinboard (it has a toread list), PinPlus can both add and act on the reading list items.

 

There are a couple Safari Reading List Workflows you can search for as well. I won’t link to them because I don’t know which (still) work. Adding and removing items is easy with those, but removing needs to be done via GUI Safari.

 

Finally, there are Workflows for Pocket and Instapaper.

Link to comment
  • 6 months later...
  • 2 months later...
  • 3 weeks later...

Tried this workflow with Chrome but it doesn't pause the video/audio. A min or so later it shows time out error in the logs

 

[11:58:31.145] Pause Tabs[Keyword] Processing complete
[11:58:31.150] Pause Tabs[Keyword] Passing output '' to Arg and Vars
[11:58:31.152] Pause Tabs[Arg and Vars] Processing complete
[11:58:31.153] Pause Tabs[Arg and Vars] Passing output '' to Automation Task
[11:58:31.154] Pause Tabs[Automation Task] Running task 'Identify Frontmost App' with no arguments
[11:58:31.457] Pause Tabs[Automation Task] Processing complete
[11:58:31.458] Pause Tabs[Automation Task] Passing output 'Alfred Preferences' to Arg and Vars
[11:58:31.464] Pause Tabs[Arg and Vars] Processing complete
[11:58:31.465] Pause Tabs[Arg and Vars] Passing output '' to Run Script
[11:58:31.946] Pause Tabs[Run Script] Processing complete
[11:58:31.947] Pause Tabs[Run Script] Passing output 'Brave Browser,Google Chrome
' to Transform
[11:58:31.953] Pause Tabs[Transform] Processing complete
[11:58:31.954] Pause Tabs[Transform] Passing output 'Brave Browser,Google Chrome' to Arg and Vars
[11:58:31.955] Pause Tabs[Arg and Vars] Processing complete
[11:58:31.956] Pause Tabs[Arg and Vars] Passing output '' to Run Script
[11:59:33.076] ERROR: Pause Tabs[Run Script] /Users/<USER>/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/D19A3B28-F1D3-47B1-8DFA-D932051BA08A: execution error: Error: Error: AppleEvent timed out. (-1712)
[11:59:33.077] Pause Tabs[Run Script] Processing complete
[11:59:33.084] Pause Tabs[Run Script] Passing output '' to Run Script
[12:01:33.391] ERROR: Pause Tabs[Run Script] /Users/<USER>/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/D19A3B28-F1D3-47B1-8DFA-D932051BA08A: execution error: Error: Error: AppleEvent timed out. (-1712)
[12:01:33.393] Pause Tabs[Run Script] Processing complete
[12:01:33.399] Pause Tabs[Run Script] Passing output '' to Run Script

 

Link to comment
19 hours ago, vitor said:

I need specific links to test. YouTube is paused just fine for me.

 

https://www.youtube.com/watch?v=Uj0EVT-Ekog

 

 

 

image.thumb.png.476e0292ec1d5ffdad38ee5c02d2ec2a.png

 

 

Logs:

[23:25:39.134] Pause Tabs[Keyword] Processing complete
[23:25:39.140] Pause Tabs[Keyword] Passing output '' to Arg and Vars
[23:25:39.142] Pause Tabs[Arg and Vars] Processing complete
[23:25:39.143] Pause Tabs[Arg and Vars] Passing output '' to Automation Task
[23:25:39.144] Pause Tabs[Automation Task] Running task 'Identify Frontmost App' with no arguments
[23:25:39.455] Pause Tabs[Automation Task] Processing complete
[23:25:39.456] Pause Tabs[Automation Task] Passing output 'Alfred Preferences' to Arg and Vars
[23:25:39.462] Pause Tabs[Arg and Vars] Processing complete
[23:25:39.463] Pause Tabs[Arg and Vars] Passing output '' to Run Script
[23:25:40.008] Pause Tabs[Run Script] Processing complete
[23:25:40.009] Pause Tabs[Run Script] Passing output 'Google Chrome,Brave Browser
' to Transform
[23:25:40.015] Pause Tabs[Transform] Processing complete
[23:25:40.017] Pause Tabs[Transform] Passing output 'Google Chrome,Brave Browser' to Arg and Vars
[23:25:40.018] Pause Tabs[Arg and Vars] Processing complete
[23:25:40.019] Pause Tabs[Arg and Vars] Passing output '' to Run Script

 

 

Link to comment

You haven’t answered the other question:

 

23 hours ago, vitor said:

Also, how many windows and tabs do you have open on each browser?

 

Two more: which keyword are you using, and which browser extensions to you have active? And that’s for all browsers, since you’re always running it with both Chrome and Brave open.

 

Edited by vitor
Link to comment

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