TwitchAdSolutions icon indicating copy to clipboard operation
TwitchAdSolutions copied to clipboard

vaft issues (freezing / paused / playback problems)

Open TsukiZero opened this issue 2 years ago • 16 comments

They might be tied to ads, but sometimes the video freeze and the audio keeps going, when this happens the quality changes from whatever it was to 360p for a moment or until the player is reset.

With "Video Swap New" it causes the quality to change completely from whatever to 360p but the frames stops freezing.

TsukiZero avatar Jun 15 '23 18:06 TsukiZero

I can confirm this. im currently watching a live LaynaLazar stream right now at the time of this comment, and i can confirm random frame freezes, on top of a video quality issue and a total video freeze

MonfGeiger avatar Jul 20 '23 22:07 MonfGeiger

This issue still persists in the new build.

TsukiZero avatar Aug 10 '23 16:08 TsukiZero

Correct. I'm not working on fixes for the freezing issues.

pixeltris avatar Aug 10 '23 16:08 pixeltris

No idea on solutions either?

TsukiZero avatar Aug 12 '23 20:08 TsukiZero

Any updates?

Zero3K avatar Sep 05 '23 01:09 Zero3K

No fix yet, no one looking into it apparently.

TsukiZero avatar Sep 05 '23 14:09 TsukiZero

This has something to do with bad connection when ads start. It does not happen if your connection is stable and have low latency

I have tested this while an ad is playing, dropping my connection in and out and it will always swap to source > 360p > source > Freeze

My testing on #222 findReactNode() was broken and lead to incorrect results but if you remove this function in the latest build there is no freezing during ads even if your connection is unstable

so.. is there a way to change the alt player/m3u8 when ads are showing to 720p or source quality or another solution?

izar3 avatar Feb 24 '24 00:02 izar3

Under vaft every time the Twitch player requests the m3u8 it requests 3 different m3u8 player types. The first two have source quality. The last doesn't. This is already pretty aggressive at trying to get the source quality. If you'd like to be more aggressive you could add a fourth request.

https://github.com/pixeltris/TwitchAdSolutions/blob/7a8fa9923ca0fac8ed293d396898eea5124c616a/vaft/vaft.user.js#L293-L296

Replace with:

weaverText = await processM3U8(url, responseText, realFetch, 'site');
if (weaverText.includes(AdSignifier)) {
    weaverText = await processM3U8(url, responseText, realFetch, PlayerType2);
}
if (weaverText.includes(AdSignifier)) {
    weaverText = await processM3U8(url, responseText, realFetch, PlayerType3);
}

This requests the main 'site' player type twice but the second one will get a new access token which can sometimes get you a clean stream faster. This constant swapping of the active m3u8 is the reason for that player pause/play / findReactNode() stuff to circumvent freezing.

Also see Purple AdBlock which is also pretty aggressive at requesting different player types https://github.com/arthurbolsoni/Purple-adblock/blob/main/serviceWorker/src/modules/stream/interface/stream.enum.ts

If this isn't good enough then you are looking for a proxy solution. See TTV LOL PRO https://github.com/younesaassila/ttv-lol-pro

pixeltris avatar Feb 24 '24 08:02 pixeltris

https://github.com/pixeltris/TwitchAdSolutions/blob/7a8fa9923ca0fac8ed293d396898eea5124c616a/vaft/vaft.user.js#L293-L296

Replace with:

weaverText = await processM3U8(url, responseText, realFetch, 'site');
if (weaverText.includes(AdSignifier)) {
    weaverText = await processM3U8(url, responseText, realFetch, PlayerType2);
}
if (weaverText.includes(AdSignifier)) {
    weaverText = await processM3U8(url, responseText, realFetch, PlayerType3);
}

I tested this for 4~ hrs with midrolls every 30-60 mins and this works way better

The only time I have seen it pause/play is at the start of a midroll but it's instant and always finds clean segments at source quality

ty pixeltris

izar3 avatar Feb 25 '24 23:02 izar3

So, the bug is back, that patch does nothing.

TsukiZero avatar Mar 17 '24 15:03 TsukiZero

I had video buffering issues and decided to look into code (I know nothing about js, just curiosity) and found this part: https://github.com/pixeltris/TwitchAdSolutions/blob/859802410009e3a9bf47a804a502f2dbbf38d150/vaft/vaft-ublock-origin.js#L93-L98 It says "This is used to fix the bug where the video would freeze." but then it 'returns' immediately after doing nothing in result. Just checking if that is intentional or mistake in commenting out that 'if'?

guniu avatar Sep 19 '24 03:09 guniu

I had video buffering issues and decided to look into code (I know nothing about js, just curiosity) and found this part:

https://github.com/pixeltris/TwitchAdSolutions/blob/859802410009e3a9bf47a804a502f2dbbf38d150/vaft/vaft-ublock-origin.js#L93-L98

It says "This is used to fix the bug where the video would freeze." but then it 'returns' immediately after doing nothing in result. Just checking if that is intentional or mistake in commenting out that 'if'?

uncommenting that causes the player settings to constantly be on screen, closing it only reopens it seconds after.

TsukiZero avatar Sep 23 '24 17:09 TsukiZero

I also have the loading/buffering issue during ads with vaft. When u start watching a stream it works, but then after a while (sometimes hours, sometimes 40mins, seems like it scales up with the amount of ads played by the streamer) the buffering/loading transition to the lower resolution when skipping the ad increases more and more until it becomes an endless buffering/loading. Only solution at that point is to manually pause/unpause the stream. Also bad is that is that you cant even close the tab and reopen to fix it, you need to restart the browser (i use the ublock vaft script on chrome). But then the issue shows up again after a while. Very awful bug.

placchio avatar Oct 09 '24 00:10 placchio

both VAFT and Video-Swap-New are now halting COMPLETELY when a midroll starts, not even player reset resumes it, only full refresh does

TsukiZero avatar Oct 10 '24 18:10 TsukiZero

Let's try to keep this a vaft focused discussion in this issue, and can get to video-swap-new later if this case is reproducible. To be clear, do you have just vaft script enabled/loaded? Using multiple scripts/twitch adblock solutions at once can cause playback to halt consistently. What is your extension/vaft setup? Not seeing that behavior where it requires a full refresh on my end, but maybe I can recreate yours.

stevenya97 avatar Oct 11 '24 03:10 stevenya97

Only one of them for sure. It was happening all the time yesterday, had to switch on the VPN to mitigate the issue.

TsukiZero avatar Oct 11 '24 15:10 TsukiZero

I also have the same freeze problem with vaft since few weeks.

Here the logs (on Zen browser, a fork of firefox) when it happens :

XHRPOST https://gql.twitch.tv/gql#origin=twilight [HTTP/3 400 162ms]

7:31:44 PM [ERROR] [apollo] Received non-200 response from GraphQL. Error: Received non-200 response from GraphQL. An https://assets.twitch.tv/assets/core-6fdb799352ac65d44bd2.js:1 s https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 s https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 h https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 h https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 An https://assets.twitch.tv/assets/core-6fdb799352ac65d44bd2.js:1 promise callback655275/e/this.apolloLinkFetch/An</< https://assets.twitch.tv/assets/core-6fdb799352ac65d44bd2.js:1 s https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 s https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 h https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 h https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 apolloLinkFetch https://assets.twitch.tv/assets/core-6fdb799352ac65d44bd2.js:1 y https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 e https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 subscribe https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 S https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 e https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 subscribe https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 bn https://assets.twitch.tv/assets/core-6fdb799352ac65d44bd2.js:1 e https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 subscribe https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 p https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 promise callback25931/p/</< https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 e https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 subscribe https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 complete https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 start https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 t https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 getObservableFromLink https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 getResultsFromLink https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 b https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 fetchQueryByPolicy https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 x https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 fetchConcastWithInfo https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 fetchQuery https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 query https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 query https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 c https://assets.twitch.tv/assets/core-6fdb799352ac65d44bd2.js:1 s https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 s https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 h https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 h https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 c https://assets.twitch.tv/assets/core-6fdb799352ac65d44bd2.js:1 l https://assets.twitch.tv/assets/core-6fdb799352ac65d44bd2.js:1 s https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 s https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 h https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 h https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 l https://assets.twitch.tv/assets/core-6fdb799352ac65d44bd2.js:1 re https://assets.twitch.tv/assets/pages.channel.components.channel-shell.components.chat-shell.components.chat-live-b32edffe677229e9cefe.js:1 s https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1 s https://assets.twitch.tv/assets/vendor-feb2465b67ee100970e0.js:1

Object { status: 400 } core-6fdb799352ac65d44bd2.js:1:1722344

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://sentry.io/api/1517394/envelope/?sentry_key=26325509987e418db03e96d12352a731&sentry_version=7&sentry_client=sentry.javascript.browser%2F8.27.0. (Reason: CORS request did not succeed). Status code: (null).

YofarDev avatar Nov 10 '24 18:11 YofarDev

In https://github.com/pixeltris/TwitchAdSolutions/commit/598cfb209c5aed2928bca034e157e65a3a1b2aff I've added a new doc file https://github.com/pixeltris/TwitchAdSolutions/blob/master/issues.md which talks about some of the playback problems. Going to close this issue. If you would like to add anything to the doc about these playback problems PRs are welcome.

A buffering mitigation was added in the same commit. Some info here https://github.com/pixeltris/TwitchAdSolutions/issues/404#issuecomment-3476570924 if you would like to give any feedback on that. Otherwise that will also be closed in due time.

pixeltris avatar Nov 01 '25 17:11 pixeltris