Suggestion: add "never auto-play" option for saved YouTube videos

When viewing a list of documents saved from YouTube, selecting them with a single click causes them to automatically play when using a three-pane window (sidebar; list window at the top; document window at the bottom). In fact, if a second YouTube document is double-clicked, both will play at the same time.

My apologies if this already exists but I have been unable to find anything that will do this and have explored the blog for this as well.

2 Likes

Thanks for the effort in looking for an answer.
Unfortunately, at this time you can’t disable auto-playing a video when the page loads in DEVONthink.

I hope this is something you will consider adding. Thanks for your help.

This isn’t under our control when you’re loading a web page from the site.

You can’t stop YouTube from autoplaying, however you could try to pause the playback afterwards.

This triggered script (see DEVONthink’s help) should be able to do it.

However it sometimes successfully stops the playback but sometimes it doesn’t, I couldn’t figure out why. I guess you could make it work reliably if you try different delay values in the script.

For easier testing there’s one line at the top which you could use to test with a selected record:

tell application id "DNtp" to my triggered(selection)

Make sure to comment this line out again before you use the script as triggered script.

Here’s the triggered script:

-- Triggered script - Play-pause YouTube 

#tell application id "DNtp" to my triggered(selection) -- this line is only for testing. afterwards comment it out by prefixing it with # 

on triggered(theRecord)
	tell application id "DNtp"
		try
			if not (exists think window 1) then return
			set theWindow to think window 1
			
			repeat 25 times
				if loading of theWindow = false then
					delay 0.2
					do JavaScript "document.getElementsByClassName('ytp-play-button ytp-button')[0].click();" in theWindow
					exit repeat
				else
					delay 0.2
				end if
			end repeat
			
		on error error_message number error_number
			if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
			return
		end try
	end tell
end triggered

If you managed to make the triggered script stop playback reliably you could use the helper script to attach the triggered script to selected records. A Smart Rule script that attaches the triggered script to all YouTube bookmarks would be possible too.

Here’s the helper script:

-- Helper script - Attach triggered script

property theTriggeredScript_Path : "/Users/USER/Desktop/Triggered Script - Play-Pause YouTube.scpt" -- Set your path here

tell application id "DNtp"
	try
		set theRecords to selected records
		if theRecords = {} then error "Please select some records"
		
		repeat with thisRecord in theRecords
			set attached script of thisRecord to theTriggeredScript_Path
		end repeat
		
	on error error_message number error_number
		if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
		return
	end try
end tell
2 Likes

Has there been any action on this issue? It has been over two years since my first post and this is very frustrating. [I will add that it is the only thing I have any frustration over with DT - I love this product and have been using it for many years]. However, please allow me to add that when I select a YouTube document and then choose “Open with” - “Safari” the document does not start playing when it opens in Safari.

1 Like