Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Youtube webcompat webextension #1047

Merged
merged 1 commit into from
Mar 29, 2019
Merged

Add Youtube webcompat webextension #1047

merged 1 commit into from
Mar 29, 2019

Conversation

MortimerGoro
Copy link
Contributor

@MortimerGoro MortimerGoro commented Mar 27, 2019

Note: When https://bugzilla.mozilla.org/show_bug.cgi?id=1511177 lands we probably can remove the viewport change injection. That should also avoid the layout change.

@ghost ghost assigned MortimerGoro Mar 27, 2019
@ghost ghost added the in progress label Mar 27, 2019
Copy link
Contributor

@bluemarvin bluemarvin left a comment

Choose a reason for hiding this comment

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

Is there anything we can do to bump up the resolution by default? Or is that on the server side?

@MortimerGoro
Copy link
Contributor Author

MortimerGoro commented Mar 28, 2019

Is there anything we can do to bump up the resolution by default? Or is that on the server side?

We should be able to do that from JS. I'm looking into it.

@MortimerGoro
Copy link
Contributor Author

I was able to get the Youtube Player API instance from the WebExtension,and check all the available qualities. But setPlaybackQuality didn't work.

I found this in the docs...

setPlaybackQuality is now considered a "no-op"; calling this function will not change the player behavior. The player will use a variety of signals to determine the optimal playback quality.
Users are able to manually request a specific playback quality via the quality selector in the player controls.

So unless we can inject a touch event and fake the click to the quality selector, it's not going to be easy to change the quality

@bluemarvin
Copy link
Contributor

@MortimerGoro, do we know what metrics they are using to select the lowest resolution? I assume this doesn’t happen on desktop?

@MortimerGoro
Copy link
Contributor Author

I think they use UA and window size, but not sure if they use more metrics. @cvan may know better

@cvan
Copy link
Contributor

cvan commented Mar 29, 2019

thanks! reviewing rn. revisiting my old notes, I'm quite certain we can make this work.

P.S. thanks for beating me to the punch in writing this patch. 😍

Copy link
Contributor

@cvan cvan left a comment

Choose a reason for hiding this comment

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

nice work! the CSS style via the content script does in fact remove the silly 360 warning 👍

I did some investigating yesterday and here are my conclusions:

https://gist.github.com/cvan/6f8196c1e8fce2165eb6847eba89f2c7

I was able to add these lines to your main.js content script, and YouTube 360 videos started playing at max quality! 😄 🎉

// Open the `Settings` menu.
document.querySelector('ytp-settings-button, .ytp-settings-button').click();

// Select the `Quality` sub-menu.
document.querySelector('ytp-settings-menu ytp-menuitem:last-child, .ytp-settings-menu .ytp-menuitem:last-child').click();

// Select the best `Quality`.
document.querySelector('ytp-quality-menu ytp-menuitem:first-child, .ytp-quality-menu .ytp-menuitem:first-child').click();

thanks for taking the initiative with this one. I'd be happy to help follow follow-up issues and write patches for the two recommendations I made in my doc.

thanks, @MortimerGoro 👍

@MortimerGoro
Copy link
Contributor Author

Good trick to change the quality @cvan! I'm going to merge this, but please create a different PR adding all the quality change code. Maybe is better to select something like 1440p by default instead of the maximum one (until we have 4K performance issues sorted out)

@MortimerGoro MortimerGoro merged commit 525310d into master Mar 29, 2019
@ghost ghost removed the in progress label Mar 29, 2019
@cvan cvan deleted the youtube_webcompat branch March 30, 2019 04:58
MortimerGoro pushed a commit that referenced this pull request Apr 11, 2019
…, `quality=` query-string parameter) (fixes issue #1051) (#1052)

* tidy up YouTube WebCompat WebExtension (follow up to PR #1047)

* automatically upgrade default YouTube video playback quality to HD 1440p (fixes issue #1051); hide `Full screen is unavailable` message (fixes issue #1056)

- or via `vq=`/`query=` query-string parameter in URLs for youtube.com and youtube-nocookie.com

* Fix SyntaxError

* Update to wait until player has resolutions available
@cvan cvan added this to the v1.1.3 milestone May 14, 2019
@cvan
Copy link
Contributor

cvan commented May 14, 2019

@cvan cvan added the enhancement This issue is a new feature or request label May 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This issue is a new feature or request
Projects
None yet
3 participants