Objective-C/AVFoundationSimplePlayer-iOS/AAPLPlayerView.m

/*
    Copyright (C) 2016 Apple Inc. All Rights Reserved.
    See LICENSE.txt for this sample’s licensing information
    
    Abstract:
    View containing an AVPlayerLayer.
*/
 
@import Foundation;
@import AVFoundation;
#import "AAPLPlayerView.h"
 
 
@implementation AAPLPlayerView
 
- (AVPlayer *)player {
    return self.playerLayer.player;
}
 
- (void)setPlayer:(AVPlayer *)player {
    self.playerLayer.player = player;
}
 
// override UIView
+ (Class)layerClass {
    return [AVPlayerLayer class];
}
 
- (AVPlayerLayer *)playerLayer {
    return (AVPlayerLayer *)self.layer;
}
 
@end