Closed dreampiggy closed 4 years ago
I'm not sure if this comment should be here or in the original issue, so I am putting it in both; if it is wrong to put it here, let me know and I will delete it.
I'm not sure if it matters, but in this case, which is right (or preferable), #1 or #2?
SDWebImageManager *manager = [[SDWebImageManager alloc] initWithCache:SDImageCache.sharedImageCache loader:SDImageLinkLoader.sharedLoader];
SDImageLinkLoader.sharedLoader.shouldfetchVideoResources = NO;
[_linkView sd_setImageWithURL:[NSURL URLWithString:linkURLString] placeholderImage:nil options:0 context:@{SDWebImageContextCustomManager:manager}];
SDImageLinkLoader.sharedLoader.shouldfetchVideoResources = NO;
SDWebImageManager *manager = [[SDWebImageManager alloc] initWithCache:SDImageCache.sharedImageCache loader:SDImageLinkLoader.sharedLoader];
[_linkView sd_setImageWithURL:[NSURL URLWithString:linkURLString] placeholderImage:nil options:0 context:@{SDWebImageContextCustomManager:manager}];
Both are OK. This property shouldfetchVideoResources
is used on demand, which means each time it will check current status.
And actually, if you just want a global control, not per-image-request control, you can set this property once.
// AppDelegate.m
- (void)applicationDidFinishLaunching:(UIApplication *)application {
//....
SDImageLinkLoader.sharedLoader.shouldfetchVideoResources = NO;
}
If you need to control each image request whether to allows video or not. This design may cause problem . We need to switch this video control into a context option. PR is needed.
This close #10