Commit e4c90cff authored by David黄金龙's avatar David黄金龙

视频播放逻辑 及UI

parent 78e4e571
......@@ -22,6 +22,9 @@ class YHHomeListModel: YHBaseModel {
var img_url: String = ""
var type: Int = 0 //文章类型 '文章类型 1视频 2图文 3图片',
var is_like : Bool = false
var media_url : String = ""
//网络返回的图片宽高
var img_width: CGFloat = 0
......
......@@ -36,8 +36,8 @@ class YHHomeCollectionViewCell: UICollectionViewCell {
lazy var descripeLable:UILabel = {
let label = UILabel()
label.text = "赴港攻略,当日往返无忧,这个季节风景..赴港攻略,当日往返无忧,这个季节风景"
label.textColor = UIColor(hexString:"#333333")
label.text = ""
label.textColor = UIColor(hex: 0x121A26, alpha: 1.0)
label.font = UIFont.PFSC_R(ofSize: 14)
label.numberOfLines = 2
label.lineBreakMode = .byWordWrapping
......@@ -78,7 +78,7 @@ class YHHomeCollectionViewCell: UICollectionViewCell {
lazy var playButton: UIButton = {
let btn = UIButton(type: .custom)
btn.setImage(UIImage(named: "home_play_btn"), for: .normal)
// btn.isHidden = true
btn.isHidden = true
return btn
}()
......@@ -91,8 +91,9 @@ class YHHomeCollectionViewCell: UICollectionViewCell {
extension YHHomeCollectionViewCell {
@objc func clickPlayButton() {
if let url = URL(string: "https://upload.cdn.galaxy-immi.com/sell/production/video/1638527500518.mp4") {
guard let listModel = listModel else { return }
//"https://upload.cdn.galaxy-immi.com/sell/production/video/1638527500518.mp4"
if listModel.media_url.isEmpty == false,let url = URL(string: listModel.media_url) {
let player = AVPlayer(url:url)
playerViewController.player = player
......@@ -176,6 +177,12 @@ extension YHHomeCollectionViewCell {
}
numLable.text = listModel.collect_count.string
heartImageViewBtn.isSelected = listModel.is_like
if listModel.type == 1 {
playButton.isHidden = false
} else {
playButton.isHidden = true
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment