I want move youtube PIP which is playing on web

Hi recently I try to move Youtube PIP position.
I don’t know why, but whenever set the Youtube video as PIP the position randomly changed.
so I try to find on chatGPT to do this as AppleScript but it not work.
Do you guys have any idea?


and error only said PIP window not found

Jason1. I don’t have Firefox, but the following works with a PIP YouTube window with Safari. There appear to be four predefined locations, and the positions in the following script moved the PIP window to these locations on my computer. You can also set the window size but, once again, there seem to be preset window sizes. Anyways, you can experiment with different values and locations.

try
	tell application "System Events" to tell process "PIPAgent"
		set size of window "PIP" to {600, 800}
		set position of window "PIP" to {100, 100} --upper-left corner
		# set position of window "PIP" to {1500, 100} --upper-right corner
		# set position of window "PIP" to {100, 1000} --lower-left corner
		# set position of window "PIP" to {1500, 1000} --lower-right corner
	end tell
on error
	display dialog "PIP window not found" buttons {"OK"} cancel button 1 default button 1
end try

Thanks it help me a lot !