1
0
mirror of https://github.com/danog/Telegram.git synced 2024-12-02 09:27:55 +01:00
Telegram/Telegraph/TGModernGalleryVideoView.m
2016-02-25 01:03:51 +01:00

45 lines
735 B
Objective-C

#import "TGModernGalleryVideoView.h"
#import <AVFoundation/AVFoundation.h>
@interface TGModernGalleryVideoView ()
{
AVPlayerLayer *_playerLayer;
}
@end
@implementation TGModernGalleryVideoView
- (instancetype)initWithFrame:(CGRect)frame player:(AVPlayer *)player
{
self = [super initWithFrame:frame];
if (self != nil)
{
self.playerLayer.player = player;
}
return self;
}
- (void)dealloc
{
void (^deallocBlock)(void) = self.deallocBlock;
if (deallocBlock != nil)
deallocBlock();
}
- (void)cleanupPlayer
{
self.playerLayer.player = nil;
}
+ (Class)layerClass
{
return [AVPlayerLayer class];
}
- (AVPlayerLayer *)playerLayer
{
return (AVPlayerLayer *)self.layer;
}
@end