You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 5, 2019. It is now read-only.
I've been constructing my own signal to pass a CGSize through AVFoundation's very useful AVMakeRectWithAspectRatioInsideRect function. Example:
self.videoScaledSizeSignal = [[RACSignal combineLatest:@[
[RACAbleWithStart(self,player.currentItem.tracks) distinctUntilChanged] ,
[RACAbleWithStart(self.maxSize) distinctUntilChanged]]
reduce:^(NSArray *array,NSValue *maxSize){
// If maxSize hasn't been set, just return a zero rect
CGSize videoScaledSize = CGSizeZero;
if (CGSizeEqualToSize(maxSize.med_sizeValue, CGSizeZero)) {
return MEDBox(videoScaledSize);
}
for (AVPlayerItemTrack *itemTrack in array) {
if ([itemTrack.assetTrack.mediaType isEqualToString:AVMediaTypeVideo]) {
CGSize naturalSize = itemTrack.assetTrack.naturalSize;
videoScaledSize = AVMakeRectWithAspectRatioInsideRect(naturalSize, CGRectWithSize(maxSize.med_sizeValue)).size;
}
}
return MEDBox(videoScaledSize);
}] filter:^BOOL(NSValue *videoScaledSize) {
return !CGSizeEqualToSize(videoScaledSize.med_sizeValue, CGSizeZero);
}];
I was going to submit a pull request for a RACSignal category containing a simplified version of my above signal, but there's a problem. AVMakeRectWithAspectRatioInsideRect requires AVFoundation, and I'm not sure it's a good idea to add a big dependency like that to RCL.
What would the best way be to add this functionality to RCL (or RAC)?