Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit 9b4226d

Browse files
committed
creating player on init seems to improve performance
1 parent 616e9ff commit 9b4226d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

AsyncDisplayKit/ASVideoNode.mm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ @implementation ASVideoNode
2626
- (instancetype)init {
2727
if (!(self = [super init])) { return nil; }
2828

29-
_playerNode = [[ASDisplayNode alloc] initWithLayerBlock:^CALayer *{ return [[AVPlayerLayer alloc] init]; }];
29+
_playerNode = [[ASDisplayNode alloc] initWithLayerBlock:^CALayer *{
30+
AVPlayerLayer *playerLayer = [[AVPlayerLayer alloc] init];
31+
playerLayer.player = [[AVPlayer alloc] init];
32+
return playerLayer;
33+
}];
3034
[self addSubnode:_playerNode];
3135

3236
self.gravity = ASVideoGravityResizeAspect;

0 commit comments

Comments
 (0)