#AVPlayerViewController

Brian Gerfort🇺🇦:shuttersnitch:2ndNatureDev@mastodon.nu
2023-10-01

Optimized v2. I wish I could attach the file here.. “Compressed” copy-pastable implementation in Alt. 😄
(Alright, added to Bitbucket: bitbucket.org/2ndnature/ios17a)
#AVPlayerViewController #Scrubbing #Fix

#import <UIKit/UIKit.h>
#import <objc/runtime.h>
@implementation NSObject(sf)+(void)load{if(@available(iOS 17.0,*)){static dispatch_once_t t;dispatch_once(&t,^{Class ac=NSClassFromString(@"AVScrubbingGesturePlatformAdapter_iOS");if(ac){void(^sw)(Class c,SEL os,SEL ns)=^void(Class c,SEL os,SEL ns){Method o=class_getInstanceMethod(c,os);Method n=class_getInstanceMethod(c,ns);BOOL a=class_addMethod(c,os,method_getImplementation(n),method_getTypeEncoding(n));if(a)class_replaceMethod(c,ns,method_getImplementation(o),method_getTypeEncoding(o));else method_exchangeImplementations(o,n);};sw(ac,NSSelectorFromString(@"setGestureEnabled:"),@selector(snEn:));sw(NSClassFromString(@"AVScrubbingGestureController"),NSSelectorFromString(@"scrubbingGesturePlatformAdapterDidBeginScrubbing:"),@selector(snSc:));}});}}-(void)snEn:(BOOL)enabled{[self snEn:YES];}-(void)snSc:(NSObject*)a{Class c=object_getClass(a);Ivar i=class_getInstanceVariable(c,"_gestureEnabled");memset((__bridge void*)a+ivar_getOffset(i),1,1);i=class_getInstanceVariable(c,"_delegate");NSObject *gc=(i)?object_getIvar(a,i):nil;if(gc){Class c2=object_getClass(gc);i=class_getInstanceVariable(c2,"_gestureConfiguration");NSObject*o=(i)?object_getIvar(gc,i):nil;if(o){i=class_getInstanceVariable(object_getClass(o),"_linearSeeking");memset((__bridge void*)o+ivar_getOffset(i),0,1);}i=class_getInstanceVariable(c2,"_enabled");BOOL e=(i)?((BOOL(*)(id,Ivar))object_getIvar)(gc,i):NO;if(!e)[(UISwitch*)gc setEnabled:YES];}[self snSc:a];}@end

Client Info

Server: https://mastodon.social
Version: 2025.07
Repository: https://github.com/cyevgeniy/lmst