AVPlayerLayer

Horus-iOS·2022년 6월 16일
0

https://developer.apple.com/documentation/avfoundation/avplayerlayer

An object that presents the visual contents of a player object.

플레이어 객체의 시각적 컨텐츠를 제공하는 객체입니다.

Declaration

class AVPlayerLayer : CALayer

Overview

iOS 혹은 tvOS에서 이 객체를 사용하기 위한 일반적인 방법은 UIView에 레이어를 두는 것입니다. 아래 예시가 보여주고 있습니다.

/// A view that displays the visual contents of a player object.
class PlayerView: UIView {

    // Override the property to make AVPlayerLayer the view's backing layer.
    override static var layerClass: AnyClass { AVPlayerLayer.self }
    
    // The associated player object.
    var player: AVPlayer? {
        get { playerLayer.player }
        set { playerLayer.player = newValue }
    }
    
    private var playerLayer: AVPlayerLayer { layer as! AVPlayerLayer }
}

Important
플레이어 레이어의 상속된 컨텐츠 값은 불투명이며 바꿀 수 없습니다.

0개의 댓글