On your Mac:
Open System Settings → Click Accessibility.
Scroll down to the Hearing section and select Live Captions.
Toggle Live Captions ON.
A floating caption window should appear when playing audio (including in Safari).
Note: This feature is only available on Apple Silicon Macs (macOS Ventura 13.5 or later).
Live captions will look something like this:


