Greasy Fork is available in English.

YouTube: Quality Auto Max

To make Quality Auto Max

< YouTube: Quality Auto Maxについてのフィードバック

レート:良 – スクリプトは良好に動作する

§
投稿日: 2024/03/30
  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
§
投稿日: 2024/03/30
編集日: 2024/03/30

yh
yh

Did it and nothing changes

§
投稿日: 2024/03/30
編集日: 2024/03/30

Fixed.

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

§
投稿日: 2024/04/04
編集日: 2024/04/04

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)

§
投稿日: 2024/04/04

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));
          }
    
§
投稿日: 2024/04/04

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));
      }
§
投稿日: 2024/04/05

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

§
投稿日: 2024/04/06

Updated

返信を投稿

返信を投稿するにはログインしてください。