CNLiveZFPlayerControlView.swift
2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//
// CNLiveZFPlayerControlView.swift
// metaCode
//
// Created by zx on 2025/2/27.
//
import Foundation
import ZFPlayer
class CNLiveZFPlayerControlView:ZFPlayerControlView{
lazy var beiSuBtn: UIButton = {
let closeBtn = UIButton(type: .custom)
closeBtn.setTitle("倍速", for: .normal)
closeBtn.setTitleColor(HexColor("#FFFFFF"), for: .normal)
closeBtn.titleLabel?.font = Font_10
closeBtn.addTarget(self, action: #selector(beiSuBtnAction), for: .touchUpInside)
closeBtn.backgroundColor = .clear
return closeBtn
}()
override init(frame: CGRect) {
super.init(frame: frame)
self.initUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func initUI(){
self.landScapeControlView.bottomToolView.addSubview(self.beiSuBtn)
}
override func layoutSubviews() {
super.layoutSubviews()
let min_margin = 9.0
let min_w = 62.0
let min_x = CGFloat(self.landScapeControlView.bottomToolView.width) - min_w - ((isiPhoneXSeries && UIApplication.shared.statusBarOrientation.isLandscape) ? 44.0: min_margin)
let min_y = 0.0
let min_h = 30.0
self.landScapeControlView.totalTimeLabel.frame = CGRect(x: min_x-100, y: min_y, width: min_w, height: min_h)
self.landScapeControlView.totalTimeLabel.centerY = self.landScapeControlView.playOrPauseBtn.centerY
let min_x1 = self.landScapeControlView.currentTimeLabel.right + 4.0
let min_y1 = 0.0
let min_w1 = self.landScapeControlView.totalTimeLabel.left - min_x1 - 4
let min_h1 = 30.0
self.landScapeControlView.slider.frame = CGRect(x: min_x1, y: min_y1, width: min_w1, height: min_h1)
self.landScapeControlView.slider.centerY = self.landScapeControlView.playOrPauseBtn.centerY
self.beiSuBtn.frame = CGRect(x: self.landScapeControlView.totalTimeLabel.right + 10.0, y: 0, width: 40, height: min_h1)
self.beiSuBtn.centerY = self.landScapeControlView.slider.centerY
// print("totalTimeLabel:\n \(self.landScapeControlView.totalTimeLabel)")
// print("slider:\n \(self.landScapeControlView.slider)")
// print("xuanjiBtn:\n \(self.xuanjiBtn)")
}
@objc func beiSuBtnAction(){
print("beiSuBtn")
}
}