mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
creating player on init seems to improve performance
This commit is contained in:
@@ -26,7 +26,11 @@
|
||||
- (instancetype)init {
|
||||
if (!(self = [super init])) { return nil; }
|
||||
|
||||
_playerNode = [[ASDisplayNode alloc] initWithLayerBlock:^CALayer *{ return [[AVPlayerLayer alloc] init]; }];
|
||||
_playerNode = [[ASDisplayNode alloc] initWithLayerBlock:^CALayer *{
|
||||
AVPlayerLayer *playerLayer = [[AVPlayerLayer alloc] init];
|
||||
playerLayer.player = [[AVPlayer alloc] init];
|
||||
return playerLayer;
|
||||
}];
|
||||
[self addSubnode:_playerNode];
|
||||
|
||||
self.gravity = ASVideoGravityResizeAspect;
|
||||
|
||||
Reference in New Issue
Block a user