Last active
October 23, 2025 12:56
-
-
Save PoomSmart/195e28fd8dda4722da538b0300ab0bd7 to your computer and use it in GitHub Desktop.
Revisions
-
PoomSmart revised this gist
Oct 23, 2025 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,9 +9,7 @@ static NSString *getClosestQualityLabel(NSArray <MLFormat *> *formats) { int minDiff = INT_MAX; NSString *closestQualityLabel; for (MLFormat *format in formats) { int resolution = [format singleDimensionResolution]; int fps = [format FPS]; int resolutionDiff = abs(resolution - targetResolution); int fpsDiff = abs(fps - targetFPS); -
PoomSmart revised this gist
Dec 8, 2024 . 1 changed file with 7 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,15 +7,17 @@ int targetFPS = 60; static NSString *getClosestQualityLabel(NSArray <MLFormat *> *formats) { int minDiff = INT_MAX; NSString *closestQualityLabel; for (MLFormat *format in formats) { int width = [format width]; int height = [format height]; int resolution = width > height ? height : width; int fps = [format FPS]; int resolutionDiff = abs(resolution - targetResolution); int fpsDiff = abs(fps - targetFPS); int totalDiff = resolutionDiff + fpsDiff; if (totalDiff < minDiff) { minDiff = totalDiff; closestQualityLabel = [format qualityLabel]; } } -
PoomSmart revised this gist
Apr 28, 2024 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ #import <YouTubeHeader/MLAVPlayer.h> #import <YouTubeHeader/MLHAMPlayerItem.h> #import <YouTubeHeader/MLQuickMenuVideoQualitySettingFormatConstraint.h> -
PoomSmart revised this gist
Apr 28, 2024 . 1 changed file with 11 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -41,3 +41,14 @@ static MLQuickMenuVideoQualitySettingFormatConstraint *getConstraint(NSString *q } %end %hook MLAVPlayer - (void)streamSelectorHasSelectableVideoFormats:(NSArray <MLFormat *> *)formats { %orig; NSString *qualityLabel = getClosestQualityLabel(formats); MLQuickMenuVideoQualitySettingFormatConstraint *constraint = getConstraint(qualityLabel); self.videoFormatConstraint = constraint; } %end -
PoomSmart revised this gist
Apr 1, 2024 . 1 changed file with 1 addition and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ #import <YouTubeHeader/MLHAMPlayerItem.h> #import <YouTubeHeader/MLQuickMenuVideoQualitySettingFormatConstraint.h> int targetResolution = 1440; int targetFPS = 60; @@ -31,16 +31,6 @@ static MLQuickMenuVideoQualitySettingFormatConstraint *getConstraint(NSString *q return constraint; } %hook MLHAMPlayerItem - (void)onSelectableVideoFormats:(NSArray <MLFormat *> *)formats { -
PoomSmart revised this gist
Apr 1, 2024 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,20 +5,20 @@ int targetResolution = 1440; int targetFPS = 60; static NSString *getClosestQualityLabel(NSArray <MLFormat *> *formats) { int minDiff = INT_MAX; int selectedFPS = 0; NSString *closestQualityLabel; for (MLFormat *format in formats) { int height = [format height]; int fps = [format FPS]; int diff = abs(height - targetResolution); if (diff < minDiff || (diff == minDiff && abs(fps - targetFPS) < abs(selectedFPS - targetFPS))) { minDiff = diff; selectedFPS = fps; closestQualityLabel = [format qualityLabel]; } } return closestQualityLabel; } static MLQuickMenuVideoQualitySettingFormatConstraint *getConstraint(NSString *qualityLabel) { -
PoomSmart revised this gist
Mar 31, 2024 . 1 changed file with 0 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -41,19 +41,6 @@ static MLQuickMenuVideoQualitySettingFormatConstraint *getConstraint(NSString *q } %end %hook MLHAMPlayerItem - (void)onSelectableVideoFormats:(NSArray <MLFormat *> *)formats { -
PoomSmart revised this gist
Mar 31, 2024 . 1 changed file with 13 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -41,6 +41,7 @@ static MLQuickMenuVideoQualitySettingFormatConstraint *getConstraint(NSString *q } %end // This, or... %hook YTQueuePlayerUtil + (void)setInitialFormatConstraintsOnPlayerItem:(MLHAMPlayerItem *)playerItem withMediaStickySettings:(MLPlayerStickySettings *)mediaStickySettings { @@ -51,3 +52,15 @@ static MLQuickMenuVideoQualitySettingFormatConstraint *getConstraint(NSString *q } %end // ...This %hook MLHAMPlayerItem - (void)onSelectableVideoFormats:(NSArray <MLFormat *> *)formats { %orig; NSString *qualityLabel = getClosestQualityLabel(formats); MLQuickMenuVideoQualitySettingFormatConstraint *constraint = getConstraint(qualityLabel); self.videoFormatConstraint = constraint; } %end -
PoomSmart revised this gist
Mar 31, 2024 . 1 changed file with 6 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,19 +2,23 @@ #import <YouTubeHeader/YTSingleVideoController.h> int targetResolution = 1440; int targetFPS = 60; static NSString *getClosestQualityLabel(NSArray <MLFormat *> *formats) { int resolution = 0; int minDiff = INT_MAX; int selectedFPS = 0; for (MLFormat *format in formats) { int height = [format height]; int fps = [format FPS]; int diff = abs(height - targetResolution); if (diff < minDiff || (diff == minDiff && abs(fps - targetFPS) < abs(selectedFPS - targetFPS))) { minDiff = diff; resolution = height; selectedFPS = fps; } } return [NSString stringWithFormat:@"%dp@%d", resolution, selectedFPS]; } static MLQuickMenuVideoQualitySettingFormatConstraint *getConstraint(NSString *qualityLabel) { -
PoomSmart revised this gist
Mar 31, 2024 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,6 @@ #import <YouTubeHeader/MLQuickMenuVideoQualitySettingFormatConstraint.h> #import <YouTubeHeader/YTSingleVideoController.h> int targetResolution = 1440; static NSString *getClosestQualityLabel(NSArray <MLFormat *> *formats) { -
PoomSmart revised this gist
Mar 31, 2024 . 1 changed file with 28 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,16 +1,35 @@ int targetResolution = 1440; static NSString *getClosestQualityLabel(NSArray <MLFormat *> *formats) { int resolution = 0; int minDiff = INT_MAX; for (MLFormat *format in formats) { int height = [format height]; int diff = abs(height - targetResolution); if (diff < minDiff) { minDiff = diff; resolution = height; } } return [NSString stringWithFormat:@"%dp", resolution]; } static MLQuickMenuVideoQualitySettingFormatConstraint *getConstraint(NSString *qualityLabel) { MLQuickMenuVideoQualitySettingFormatConstraint *constraint; @try { constraint = [[%c(MLQuickMenuVideoQualitySettingFormatConstraint) alloc] initWithVideoQualitySetting:3 formatSelectionReason:2 qualityLabel:qualityLabel]; } @catch (id ex) { constraint = [[%c(MLQuickMenuVideoQualitySettingFormatConstraint) alloc] initWithVideoQualitySetting:3 formatSelectionReason:2 qualityLabel:qualityLabel resolutionCap:0]; } return constraint; } %hook YTSingleVideoController - (void)setInitialAudioAndVideoConstraints { %orig; NSString *qualityLabel = getClosestQualityLabel([self.playerItem selectableVideoFormats]); MLQuickMenuVideoQualitySettingFormatConstraint *constraint = getConstraint(qualityLabel); self.playerItem.videoFormatConstraint = constraint; } %end @@ -19,11 +38,8 @@ + (void)setInitialFormatConstraintsOnPlayerItem:(MLHAMPlayerItem *)playerItem withMediaStickySettings:(MLPlayerStickySettings *)mediaStickySettings { %orig; NSString *qualityLabel = getClosestQualityLabel([playerItem selectableVideoFormats]); MLQuickMenuVideoQualitySettingFormatConstraint *constraint = getConstraint(qualityLabel); playerItem.videoFormatConstraint = constraint; } -
PoomSmart revised this gist
Mar 31, 2024 . 1 changed file with 15 additions and 23 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,38 +1,30 @@ #import <YouTubeHeader/MLQuickMenuVideoQualitySettingFormatConstraint.h> #import <YouTubeHeader/YTSingleVideoController.h> %hook YTSingleVideoController - (void)setInitialAudioAndVideoConstraints { %orig; MLQuickMenuVideoQualitySettingFormatConstraint *constraint; @try { constraint = [[%c(MLQuickMenuVideoQualitySettingFormatConstraint) alloc] initWithVideoQualitySetting:3 formatSelectionReason:2 qualityLabel:@"1440p"]; } @catch (id ex) { constraint = [[%c(MLQuickMenuVideoQualitySettingFormatConstraint) alloc] initWithVideoQualitySetting:3 formatSelectionReason:2 qualityLabel:@"1440p" resolutionCap:0]; } self.playerItem.videoFormatConstraint = constraint; } %end %hook YTQueuePlayerUtil + (void)setInitialFormatConstraintsOnPlayerItem:(MLHAMPlayerItem *)playerItem withMediaStickySettings:(MLPlayerStickySettings *)mediaStickySettings { %orig; @try { constraint = [[%c(MLQuickMenuVideoQualitySettingFormatConstraint) alloc] initWithVideoQualitySetting:3 formatSelectionReason:2 qualityLabel:@"1440p"]; } @catch (id ex) { constraint = [[%c(MLQuickMenuVideoQualitySettingFormatConstraint) alloc] initWithVideoQualitySetting:3 formatSelectionReason:2 qualityLabel:@"1440p" resolutionCap:0]; } playerItem.videoFormatConstraint = constraint; } %end -
PoomSmart created this gist
Mar 30, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ #import <YouTubeHeader/YTSingleVideoController.h> enum VideoQualitySetting : int { kVideoQualitySettingAuto = 0, kVideoQualitySetting144p = 1, kVideoQualitySetting240p = 2, kVideoQualitySetting360p = 3, kVideoQualitySetting480p = 4, kVideoQualitySetting720p = 5, kVideoQualitySetting1080p = 6, kVideoQualitySetting1440p = 7, kVideoQualitySetting2160p = 8, }; %hook YTHotConfig - (BOOL)iosPlayerClientSharedConfigEnableStrongStickyVideoQuality { return YES; } %end %hook YTSingleVideoController - (void)setInitialAudioAndVideoConstraints { self.mediaStickySettings.videoQualitySetting = kVideoQualitySetting1440p; %orig; } %end %hook YTQueuePlayerUtil + (void)setInitialFormatConstraintsOnPlayerItem:(id)playerItem withMediaStickySettings:(MLPlayerStickySettings *)mediaStickySettings { mediaStickySettings.videoQualitySetting = kVideoQualitySetting1440p; %orig; } %end