Skip to content

Commit

Permalink
修复播放器完成播放后进度不能到达100%
Browse files Browse the repository at this point in the history
代理方法更正为可实现
增加部分只读属性
增加播放器进度变化代理
  • Loading branch information
JmoVxia committed Dec 22, 2021
1 parent 62932dd commit a9a7ec0
Show file tree
Hide file tree
Showing 11 changed files with 342 additions and 277 deletions.
159 changes: 0 additions & 159 deletions CLAutolayoutController/CLAutolayoutController.swift

This file was deleted.

24 changes: 14 additions & 10 deletions CLCollectionViewController/CLCollectionViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ class CLCollectionViewController: CLController {
deinit {}

private lazy var collectionView: UICollectionView = {
let width = (view.bounds.width - 30) * 0.5
let layout = UICollectionViewFlowLayout()
layout.minimumLineSpacing = 10
layout.minimumInteritemSpacing = 10
layout.itemSize = CGSize(width: view.bounds.width - 20, height: (view.bounds.width - 20) * 9.0 / 16.0)
layout.itemSize = CGSize(width: width, height: width * 9.0 / 16.0)
let view = UICollectionView(frame: .zero, collectionViewLayout: layout)
view.contentInset = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
view.backgroundColor = .clear
Expand Down Expand Up @@ -126,7 +127,16 @@ private extension CLCollectionViewController {

// MARK: - JmoVxia---override

extension CLCollectionViewController {}
extension CLCollectionViewController {
override var shouldAutorotate: Bool {
return false
}

// 支持哪些屏幕方向
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return .portrait
}
}

// MARK: - JmoVxia---objc

Expand All @@ -148,10 +158,7 @@ private extension CLCollectionViewController {
})
player?.url = URL(string: array[indexPath.row])
cell.contentView.addSubview(player!)
player?.snp.remakeConstraints { make in
make.top.left.equalToSuperview()
make.size.equalTo(CGSize(width: cell.bounds.width, height: cell.bounds.height - 10))
}
player?.frame = cell.contentView.bounds
player?.play()
}
}
Expand Down Expand Up @@ -181,10 +188,7 @@ extension CLCollectionViewController: UICollectionViewDelegate {
guard array[indexPath.row] == player.url?.absoluteString else { return }

cell.contentView.addSubview(player)
player.snp.remakeConstraints { make in
make.top.left.equalToSuperview()
make.size.equalTo(CGSize(width: cell.bounds.width, height: cell.bounds.height - 10))
}
player.frame = cell.contentView.bounds
player.play()
}

Expand Down
21 changes: 4 additions & 17 deletions CLHomeController/Controller/CLHomeController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,10 @@ private extension CLHomeController {
func initData() {
do {
let item = CLListItem()
item.title = "Autolayout创建"
item.title = "普通View"
item.didSelectCellCallback = { [weak self] _ in
guard let self = self else { return }
self.pushToAutolayout()
}
tableViewHepler.dataSource.append(item)
}
do {
let item = CLListItem()
item.title = "Frame创建"
item.didSelectCellCallback = { [weak self] _ in
guard let self = self else { return }
self.pushToFrame()
self.pushToView()
}
tableViewHepler.dataSource.append(item)
}
Expand Down Expand Up @@ -147,12 +138,8 @@ extension CLHomeController {}
// MARK: - JmoVxia---私有方法

private extension CLHomeController {
func pushToAutolayout() {
navigationController?.pushViewController(CLAutolayoutController(), animated: true)
}

func pushToFrame() {
navigationController?.pushViewController(CLFrameController(), animated: true)
func pushToView() {
navigationController?.pushViewController(CLViewController(), animated: true)
}

func pushToTableView() {
Expand Down
26 changes: 7 additions & 19 deletions CLPlayer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
5BE1F31B2727DCDB0090F6C8 /* CLMoreController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BE1F31A2727DCDB0090F6C8 /* CLMoreController.swift */; };
5BE1F3202727DDC00090F6C8 /* CLListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BE1F31F2727DDC00090F6C8 /* CLListCell.swift */; };
5BE1F3252727DE4C0090F6C8 /* CLListItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BE1F3242727DE4C0090F6C8 /* CLListItem.swift */; };
5BE1F32A2727E0F80090F6C8 /* CLAutolayoutController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BE1F3292727E0F80090F6C8 /* CLAutolayoutController.swift */; };
5BE1F32D2727E1430090F6C8 /* CLTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BE1F32C2727E1430090F6C8 /* CLTableViewController.swift */; };
5BE1F3322727E21E0090F6C8 /* CLBackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BE1F3312727E21E0090F6C8 /* CLBackView.swift */; };
5BE1F3342727E3800090F6C8 /* UIImage+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BE1F3332727E3800090F6C8 /* UIImage+Extension.swift */; };
Expand All @@ -45,7 +44,7 @@
5BF306642728DFB40046075A /* CLFullScreenController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BF306632728DFB40046075A /* CLFullScreenController.swift */; };
5BFADCAC2767415200A596A6 /* CLPlayerContentPanelHeadView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BFADCAB2767415200A596A6 /* CLPlayerContentPanelHeadView.swift */; };
5BFADCAE276742F500A596A6 /* CLPlayerContentPanelCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BFADCAD276742F500A596A6 /* CLPlayerContentPanelCell.swift */; };
5BFADCB6276888B400A596A6 /* CLFrameController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BFADCB5276888B400A596A6 /* CLFrameController.swift */; };
5BFADCB6276888B400A596A6 /* CLViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BFADCB5276888B400A596A6 /* CLViewController.swift */; };
5BFADCBA276893B600A596A6 /* CLGCDTimer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BFADCB9276893B600A596A6 /* CLGCDTimer.swift */; };
5BFADCC027689C5500A596A6 /* CLTableViewItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BFADCBF27689C5500A596A6 /* CLTableViewItem.swift */; };
5BFADCC227689C6300A596A6 /* CLTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BFADCC127689C6300A596A6 /* CLTableViewCell.swift */; };
Expand Down Expand Up @@ -84,7 +83,6 @@
5BE1F31A2727DCDB0090F6C8 /* CLMoreController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CLMoreController.swift; sourceTree = "<group>"; };
5BE1F31F2727DDC00090F6C8 /* CLListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CLListCell.swift; sourceTree = "<group>"; };
5BE1F3242727DE4C0090F6C8 /* CLListItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CLListItem.swift; sourceTree = "<group>"; };
5BE1F3292727E0F80090F6C8 /* CLAutolayoutController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CLAutolayoutController.swift; sourceTree = "<group>"; };
5BE1F32C2727E1430090F6C8 /* CLTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CLTableViewController.swift; sourceTree = "<group>"; };
5BE1F3312727E21E0090F6C8 /* CLBackView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CLBackView.swift; sourceTree = "<group>"; };
5BE1F3332727E3800090F6C8 /* UIImage+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIImage+Extension.swift"; sourceTree = "<group>"; };
Expand All @@ -93,7 +91,7 @@
5BF306632728DFB40046075A /* CLFullScreenController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CLFullScreenController.swift; sourceTree = "<group>"; };
5BFADCAB2767415200A596A6 /* CLPlayerContentPanelHeadView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CLPlayerContentPanelHeadView.swift; sourceTree = "<group>"; };
5BFADCAD276742F500A596A6 /* CLPlayerContentPanelCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CLPlayerContentPanelCell.swift; sourceTree = "<group>"; };
5BFADCB5276888B400A596A6 /* CLFrameController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CLFrameController.swift; sourceTree = "<group>"; };
5BFADCB5276888B400A596A6 /* CLViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CLViewController.swift; sourceTree = "<group>"; };
5BFADCB9276893B600A596A6 /* CLGCDTimer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CLGCDTimer.swift; sourceTree = "<group>"; };
5BFADCBF27689C5500A596A6 /* CLTableViewItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CLTableViewItem.swift; sourceTree = "<group>"; };
5BFADCC127689C6300A596A6 /* CLTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CLTableViewCell.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -166,8 +164,7 @@
5B37DEE82727DBD9002A377A /* CLTableView */,
5BE1F31C2727DD960090F6C8 /* CLHomeController */,
5BE1F31D2727DDA10090F6C8 /* CLMoreController */,
5BE1F3282727E0C60090F6C8 /* CLAutolayoutController */,
5BFADCB42768888500A596A6 /* CLFrameController */,
5BFADCB42768888500A596A6 /* CLViewController */,
5BE1F32B2727E11F0090F6C8 /* CLTableViewController */,
5BC41036276B188900DFE028 /* CLCollectionViewController */,
5BE1F3372727E55E0090F6C8 /* Resources */,
Expand Down Expand Up @@ -285,14 +282,6 @@
path = Cell;
sourceTree = "<group>";
};
5BE1F3282727E0C60090F6C8 /* CLAutolayoutController */ = {
isa = PBXGroup;
children = (
5BE1F3292727E0F80090F6C8 /* CLAutolayoutController.swift */,
);
path = CLAutolayoutController;
sourceTree = "<group>";
};
5BE1F32B2727E11F0090F6C8 /* CLTableViewController */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -354,12 +343,12 @@
path = Resources;
sourceTree = "<group>";
};
5BFADCB42768888500A596A6 /* CLFrameController */ = {
5BFADCB42768888500A596A6 /* CLViewController */ = {
isa = PBXGroup;
children = (
5BFADCB5276888B400A596A6 /* CLFrameController.swift */,
5BFADCB5276888B400A596A6 /* CLViewController.swift */,
);
path = CLFrameController;
path = CLViewController;
sourceTree = "<group>";
};
5BFADCB72768936C00A596A6 /* CLPlayerContentView */ = {
Expand Down Expand Up @@ -567,7 +556,6 @@
5BA39B182727D147005059F5 /* AppDelegate.swift in Sources */,
5B37DEF02727DBD9002A377A /* CLCellProtocol.swift in Sources */,
5B37DEEF2727DBD9002A377A /* CLCellItemProtocol.swift in Sources */,
5BE1F32A2727E0F80090F6C8 /* CLAutolayoutController.swift in Sources */,
5B33B4DE2769EAA20086B402 /* CLPlayerConfigure.swift in Sources */,
5BE1F3322727E21E0090F6C8 /* CLBackView.swift in Sources */,
5B72C197272A868E004B9AEA /* CLPlayerContentViewDelegate.swift in Sources */,
Expand All @@ -589,7 +577,7 @@
5B37DEE52727DB04002A377A /* CLController.swift in Sources */,
5BA11A70276AD7290093B418 /* NSMutableAttributedString+Extension.swift in Sources */,
5BE1F3202727DDC00090F6C8 /* CLListCell.swift in Sources */,
5BFADCB6276888B400A596A6 /* CLFrameController.swift in Sources */,
5BFADCB6276888B400A596A6 /* CLViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Loading

0 comments on commit a9a7ec0

Please sign in to comment.