Skip to content

Commit

Permalink
Merge pull request #2221 from raszpl/patch-3
Browse files Browse the repository at this point in the history
Update player.js unmangle
  • Loading branch information
ImprovedTube authored Apr 29, 2024
2 parents f1ab739 + 8ec1173 commit b1e9fc4
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions js&css/web-accessible/www.youtube.com/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,8 @@ ImprovedTube.playerAutofullscreen = function () {
QUALITY
------------------------------------------------------------------------------*/
ImprovedTube.playerQuality = function (quality = this.storage.player_quality) {
if (quality && (let player = this.elements.player) && player.getAvailableQualityLevels
let player = this.elements.player;
if (quality && player && player.getAvailableQualityLevels
&& (!player.dataset.defaultQuality || player.dataset.defaultQuality != quality)) {
let available_quality_levels = player.getAvailableQualityLevels();
function closest(num, arr) {
Expand Down Expand Up @@ -526,16 +527,17 @@ ImprovedTube.playerQuality = function (quality = this.storage.player_quality) {
QUALITY WITHOUT FOCUS
------------------------------------------------------------------------------*/
ImprovedTube.playerQualityWithoutFocus = function () {
let player = this.elements.player,
qualityWithoutFocus = this.storage.player_quality_without_focus;
if (qualityWithoutFocus && qualityWithoutFocus !== 'auto' ) {
if (qualityWithoutFocus && qualityWithoutFocus !== 'auto' && player && player.getPlaybackQuality) {
if (this.focus) {
if (ImprovedTube.qualityBeforeBlur) {
ImprovedTube.playerQuality(ImprovedTube.qualityBeforeBlur);
}
}
} else {
if ((let player = this.elements.player) && player.getPlaybackQuality && !ImprovedTube.elements.video.paused) {
ImprovedTube.qualityBeforeBlur = player.getPlaybackQuality();
ImprovedTube.playerQuality(qualityWithoutFocus);
if (!ImprovedTube.elements.video.paused) {
ImprovedTube.qualityBeforeBlur = player.getPlaybackQuality();
ImprovedTube.playerQuality(qualityWithoutFocus);
}
}
}
Expand Down

0 comments on commit b1e9fc4

Please sign in to comment.