Skip to content

youtube quality android - #196

Open
tapanmodh wants to merge 4 commits into
masterfrom
youtube_quality_android
Open

youtube quality android#196
tapanmodh wants to merge 4 commits into
masterfrom
youtube_quality_android

Conversation

@tapanmodh

@tapanmodh tapanmodh commented Aug 6, 2024

Copy link
Copy Markdown

Related to issue: brave/brave-browser#32842
Brave-core PR: brave/brave-core#24164
Adblock-lists PR: brave/adblock-lists#1944

Comment thread resources/brave-youtube-quality.js Outdated
function handlePlaybackVideoQuality() {
let attemptCount = 0;
const maxAttempts = 5;
clearInterval(intervalId);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't it be better to use a mutation observer here?

@@ -0,0 +1,56 @@
/// brave-youtube-quality.js
(function() {
const IS_MOBILE_YOUTUBE = window.location.hostname == 'm.youtube.com';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hostname could be www.youtube.com

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to include both as we need m.youtube.com for mobile sites and www.youtube.com for desktop sites option

/// brave-youtube-quality.js
(function() {
const IS_MOBILE_YOUTUBE = window.location.hostname == 'm.youtube.com';
const IS_ANDROID = window.navigator.userAgent.indexOf('Android') > -1;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why don't you decide whether to inject the script or not in native (java or cpp)?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stoletheminerals it's not possible if we're using this via adblock scriptlet injections; those can be selectively injected per-domain, but not according to any other criteria. If you want to move checks to native code it'll have to be a completely separate injection mechanism.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@antonok-edm thanks, yeah that makes sense. I'm just not sure why we decided to move this code to adblock scriptlets. To me it's weird to inject first and then check if we injected it on Android, when we could decide before the injection, but I understand that we can't do it in the current implementation. Anyway, it's not a security concern.

@tapanmodh
tapanmodh force-pushed the youtube_quality_android branch from fe6a3ae to ccf5518 Compare August 9, 2024 08:53
@@ -0,0 +1,30 @@
/// brave-youtube-quality.js
(function() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tapanmodh do you know if the same script works for desktop ? I think It should. We can create an issue for the desktop if we want to use the same feature on the desktop.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, same script works for desktop

Comment thread filter_lists/list_catalog.json Outdated
},
{
"url": "https://raw.githubusercontent.com/brave/adblock-lists/master/brave-lists/brave-specific.txt",
"url": "https://raw.githubusercontent.com/brave/adblock-lists/d2ab11d0241c5e135315652de96c52fa975dd0a0/brave-lists/brave-specific.txt",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was for testing. I'll revert this to master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants