iOS 播放器 SDK

自定義使用者界面

(以下內容均翻譯自英文版文件,最新資訊及內容敬請切換至英文語系參考原文)

 

步驟 1:建立自定義使用者界面

請參照以下提供的範例程式碼:

// Create a subclass of UIView
class CustomView: UIView {
    init(player: Player, frame: CGRect) {
        super.init(frame: frame)

        // register the AVPlayerLayer of this view to the Player
        player.register(playerLayer)
    }

    var playerLayer: AVPlayerLayer {
        layer as! AVPlayerLayer
    }

    override class var layerClass: AnyClass {
        AVPlayerLayer.self
    }
}

 

步驟 2:添加自定義的使用者界面組件

使用 BV 提供的 APIs 在播放器使用者界面上建立控制器,以實現自定義的播放行為。

 

了解更多

 

更新於