AVAutoWait/PlayerView.swift
/* |
Copyright (C) 2016 Apple Inc. All Rights Reserved. |
See LICENSE.txt for this sample’s licensing information |
Abstract: |
Simple UIView subclass containing an AVPlayerLayer |
*/ |
import UIKit |
import AVFoundation |
/// A very simple view only containing an AVPlayerLayer. |
class PlayerView: UIView { |
static override var layerClass: AnyClass { |
return AVPlayerLayer.self |
} |
var player : AVPlayer? { |
set { |
let playerLayer = layer as! AVPlayerLayer |
playerLayer.player = newValue |
} |
get { |
let playerLayer = layer as! AVPlayerLayer |
return playerLayer.player |
} |
} |
} |
Copyright © 2016 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2016-09-13