rain-fighters / AudioPick

A Chrome Extension to pick a preferred audio output device for HTML5 audio and video elements
https://rain-fighters.github.io/AudioPick/
GNU General Public License v3.0
102 stars 22 forks source link

Not working on YouTube #53

Open fred-lart opened 8 months ago

fred-lart commented 8 months ago

Chrome Version 121.0.6167.140 Extension 0.3.10 Windows11

Hi ! Thanks for your work.

I did a quick debug but could not find the exact issue, the only info I get is DOMException: The operation could not be performed and was aborted

At the same time I did a quick check on chrome and tried to change my sinkId inside the AudioContext class with the method setSinkId but I get an error telling me that the ID does not exist. Also the basic way to list device I found on google return me a set of device with deviceId, sinkId, ... but all of them are empty string...

In the debug, previous SinkID is also empty string.

Could someone give me some help to solve this issue ?

necropola commented 8 months ago

That's werid. YT is one of the tested sites/scenarios and it's actually one of the easier cases to handle for AudioPick since it just uses a visible video element and not an AudioContext.

Can you enable debug, open the Developer Tools and then copy & paste what the extension writes to console.log (Filter for APV3) ?

fred-lart commented 8 months ago

Alright, here is my logs filtered with APV3:

APV3-content.js (top-origin: https://www.youtube.com) | onMessage: getActiveDevice | sendResponse: default
content.js:17 APV3-content.js (top-origin: https://www.youtube.com) | onMessage: setActiveDevice | sendAudioDevice: Out 1-2 (MOTU M Series) (07fd:0008)
content.js:17 APV3-content.js (top-origin: https://www.youtube.com) | setAudioDevice: Out 1-2 (MOTU M Series) (07fd:0008) | micPolicy.state: granted
content.js:17 APV3-content.js (top-origin: https://www.youtube.com) | injectSink: 88164f337c7144aa8d33990cf05c68a1749c614e387919e58c11c396e955282d | micPolicy.state: granted
main.js:27 APV3-main.js (top-origin: https://www.youtube.com) | changeSinkId(try): HTMLVideoElement | targetElement: <video tabindex=​"-1" class=​"video-stream html5-main-video" controlslist=​"nodownload" style=​"width:​ 987px;​ height:​ 555px;​ left:​ 0px;​ top:​ 0px;​" src=​"blob:​https:​/​/​www.youtube.com/​a55e6372-0cec-459b-be97-743f45a6195e">​</video>​media | sourceOfAudioContext: undefined | foundViaMethod: addEventListener_focus_hook | oldSinkId:  | sinkId: 88164f337c7144aa8d33990cf05c68a1749c614e387919e58c11c396e955282d
main.js:27 APV3-main.js (top-origin: https://www.youtube.com) | changeSinkId(try): HTMLVideoElement | targetElement: <video tabindex=​"-1" class=​"video-stream html5-main-video" data-no-fullscreen=​"true" controlslist=​"nodownload" style=​"width:​ 363px;​ height:​ 204px;​ left:​ 0px;​ top:​ -204px;​">​</video>​media | sourceOfAudioContext: undefined | foundViaMethod: addEventListener_focus_hook | oldSinkId:  | sinkId: 88164f337c7144aa8d33990cf05c68a1749c614e387919e58c11c396e955282d
main.js:27 APV3-main.js (top-origin: https://www.youtube.com) | changeSinkId(catch): HTMLVideoElement | targetElement: <video tabindex=​"-1" class=​"video-stream html5-main-video" controlslist=​"nodownload" style=​"width:​ 987px;​ height:​ 555px;​ left:​ 0px;​ top:​ 0px;​" src=​"blob:​https:​/​/​www.youtube.com/​a55e6372-0cec-459b-be97-743f45a6195e">​</video>​media | sourceOfAudioContext: undefined | foundViaMethod: addEventListener_focus_hook | oldSinkId:  | sinkId: 88164f337c7144aa8d33990cf05c68a1749c614e387919e58c11c396e955282d | error: DOMException: The operation could not be performed and was aborted
main.js:27 APV3-main.js (top-origin: https://www.youtube.com) | setSinkId(try): HTMLVideoElement | targetElement: <video tabindex=​"-1" class=​"video-stream html5-main-video" controlslist=​"nodownload" style=​"width:​ 987px;​ height:​ 555px;​ left:​ 0px;​ top:​ 0px;​" src=​"blob:​https:​/​/​www.youtube.com/​a55e6372-0cec-459b-be97-743f45a6195e">​</video>​media | sourceOfAudioContext: undefined | foundViaMethod: play_hook | oldSinkId:  | sinkId: 88164f337c7144aa8d33990cf05c68a1749c614e387919e58c11c396e955282d
main.js:27 APV3-main.js (top-origin: https://www.youtube.com) | setSinkId(catch): HTMLVideoElement | targetElement: <video tabindex=​"-1" class=​"video-stream html5-main-video" controlslist=​"nodownload" style=​"width:​ 987px;​ height:​ 555px;​ left:​ 0px;​ top:​ 0px;​" src=​"blob:​https:​/​/​www.youtube.com/​a55e6372-0cec-459b-be97-743f45a6195e">​</video>​media | sourceOfAudioContext: undefined | foundViaMethod: addEventListener_focus_hook | oldSinkId:  | sinkId: 88164f337c7144aa8d33990cf05c68a1749c614e387919e58c11c396e955282d | error: DOMException: The operation could not be performed and was aborted

Maybe there is duplicate logs since I forgot to disable some breakpoints in your code.

necropola commented 8 months ago
  1. Does it work on any other site? (I guess, it does not.)
  2. Could your try with a fresh browser/chrome profile?
  3. Coud you try a different audio device?

I'm currently suspecting an issue with either the audio hardware or the driver. A quick google search shows that MOTU is rather notorious for causing problems.

fred-lart commented 7 months ago
  1. No it does not, Soundcloud for example does not work either but doesn't generate errors.
  2. I tried on private navigation, it does not change the issue.
  3. I turned off my audio device and used the internal audio device for the 2 previous step so it does not come from MOTU.

I doubt a fresh install would change anything, I will still try with chromium we never know.