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

发表回复

登录(不可用)以发表回复。

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址