|
@@ -13,7 +13,7 @@ public class PQSingletoVideoPlayer: NSObject {
|
|
|
public static let shared = PQSingletoVideoPlayer()
|
|
|
public var isPlayEnd: Bool = false
|
|
|
public var isRealPlay: Bool = false
|
|
|
- public var isSemiRealPlay: Bool = false
|
|
|
+ public var isSemiRealPlay: Bool = false
|
|
|
public var isPlayBegin: Bool = false
|
|
|
public var isFirstFrame: Bool = false
|
|
|
public var isPlayerError: Bool = false
|
|
@@ -40,6 +40,10 @@ public class PQSingletoVideoPlayer: NSObject {
|
|
|
return player
|
|
|
}()
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
public func configPlyer(videoData: PQVideoListModel, controllerView: UIView) {
|
|
|
isPlayEnd = false
|
|
|
isRealPlay = false
|
|
@@ -48,10 +52,8 @@ public class PQSingletoVideoPlayer: NSObject {
|
|
|
isFirstFrame = false
|
|
|
isPlayerError = false
|
|
|
loadingTime = Date().timeIntervalSince1970 * 1000
|
|
|
-
|
|
|
player.stopPlay()
|
|
|
player.removeVideoWidget()
|
|
|
-
|
|
|
player.setupVideoWidget(controllerView, insert: 0)
|
|
|
player.enableHWAcceleration = true
|
|
|
playControllerView = controllerView
|
|
@@ -70,13 +72,12 @@ public class PQSingletoVideoPlayer: NSObject {
|
|
|
}
|
|
|
playId = getUniqueId(desc: "playId")
|
|
|
BFLog(message: "\(String(describing: videoData.title)) 开始播放 \(videoData.videoPath ?? "")")
|
|
|
- player.startPlay(videoData.videoPath)
|
|
|
-
|
|
|
if PQSingletoMemoryUtil.shared.playCount < 4 {
|
|
|
PQSingletoMemoryUtil.shared.playCount = PQSingletoMemoryUtil.shared.playCount + 1
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
public func resetPlayer() {
|
|
|
if playControllerView != nil {
|
|
|
player.removeVideoWidget()
|
|
@@ -94,18 +95,31 @@ public class PQSingletoVideoPlayer: NSObject {
|
|
|
player.setStartTime(progress)
|
|
|
}
|
|
|
playId = getUniqueId(desc: "playId")
|
|
|
- player.startPlay(playVideoData!.videoPath)
|
|
|
+
|
|
|
+ startPlayr()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public func startPlayr() {
|
|
|
+ BFLog(message: "开始播放 \(playVideoData?.videoPath ?? "")")
|
|
|
+ if isValidURL(url: playVideoData?.videoPath) {
|
|
|
+ player.startPlay(playVideoData?.videoPath)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
public func pausePlayer() {
|
|
|
player.pause()
|
|
|
}
|
|
|
|
|
|
+
|
|
|
public func resumePlayer() {
|
|
|
player.resume()
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
public func stopPlayer(isRemove: Bool = true) {
|
|
|
player.stopPlay()
|
|
|
if isRemove {
|