Greasy Fork is available in English.

YouTube: Quality Auto Max

To make Quality Auto Max

< Valutazione su YouTube: Quality Auto Max

Recensione: Bene - lo script funziona

§
Pubblicato: 30/03/2024
  1. It worked before?
  2. Did you disable all other related scripts?
  3. After disable all other related scripts, change the video quality from high to low, refresh and then low to high
§
Pubblicato: 30/03/2024
Modificato: 30/03/2024

yh
yh

Did it and nothing changes

§
Pubblicato: 30/03/2024
Modificato: 30/03/2024

Fixed.

This is because YouTube now uses multiple tracks for the same video.

§
Pubblicato: 04/04/2024
Modificato: 04/04/2024

Currently this is not working for embedded videos. As I don't really watch YouTube in embedded mode.

(no ytd-player#ytd-player in embedded mode; the logs are for the youtube APIs which are functional ready. You should get the same log in normal YouTube)

In future might add the support for embedded videos.

(I think just switch from ytd-player#ytd-player to #movie_player should be fine. but no time to amend and test)

§
Pubblicato: 04/04/2024

Just need to change the following part:

          const target = (evt || 0).target
          if (!(target instanceof HTMLMediaElement)) return;
          pm2.resolve();
          const pm1 = pm2 = new PromiseExternal();
          const mainMedia = await observablePromise(() => {
            return document.querySelector('ytd-player#ytd-player #movie_player .html5-main-video')
          }, pm2.then()).obtain();
          if (!mainMedia) return;
          if (pm1 !== pm2) return;
          const ytdPlayerElm = mainMedia.closest('ytd-player#ytd-player');
          if (!ytdPlayerElm) return;


          let _url = lastURL;
          let url = mainMedia.src;
          if (url === _url) return;
          lastURL = url;

          let player_
          for (let i = 10; --i;) {
            player_ = await ((insp(ytdPlayerElm) || 0).player_ || 0);
            if (player_) break;
            await new Promise(r => setTimeout(r));
          }

Guess just need to change these. Test by yourself.

  1. document.querySelector('#movie_player .html5-main-video'), mainMedia.closest('#movie_player')
  2. 
          let player_
          for (let i = 10; --i;) {
            let tmpCnt = insp(ytdPlayerElm);
            player_ = await (tmpCnt._player || (tmpCnt.setPlaybackQualityRange ? tmpCnt : 0));
            if (player_) break;
            await new Promise(r => setTimeout(r));
          }
    
§
Pubblicato: 04/04/2024

typo.


      let player_
      for (let i = 10; --i;) {
        let tmpCnt = insp(ytdPlayerElm);
        player_ = await (tmpCnt.player_ || (tmpCnt.setPlaybackQualityRange ? tmpCnt : 0));
        if (player_) break;
        await new Promise(r => setTimeout(r));
      }
§
Pubblicato: 05/04/2024

that didn't work

Now it just keeps printing
userscript.html?name…24-bbff8d5097d3:349
Uncaught ReferenceError: Cannot access 'mainMedia' before initialization
at userscript.html?name…bbff8d5097d3:349:89
at MutationObserver.f (userscript.html?name…-bbff8d5097d3:53:23)
(anonymous) @ userscript.html?name…24-bbff8d5097d3:349
f @ userscript.html?name…824-bbff8d5097d3:53

§
Pubblicato: 06/04/2024

Updated

Pubblica risposta

Accedi per pubblicare una risposta.