mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Update MediaPlayer
This commit is contained in:
parent
c280754647
commit
25e0b2734d
@ -310,12 +310,28 @@ private final class MediaPlayerContext {
|
||||
duration = max(duration, CMTimeGetSeconds(audioTrackFrameBuffer.duration))
|
||||
}
|
||||
loadedDuration = duration
|
||||
let status = MediaPlayerStatus(generationTimestamp: CACurrentMediaTime(), duration: duration, dimensions: CGSize(), timestamp: min(max(timestamp, 0.0), duration), baseRate: self.baseRate, seekId: self.seekId, status: .buffering(initial: false, whilePlaying: action == .play, progress: 0.0, display: true), soundEnabled: self.enableSound)
|
||||
|
||||
let statusTimestamp: Double
|
||||
if duration == 0.0 {
|
||||
statusTimestamp = max(timestamp, 0.0)
|
||||
} else {
|
||||
statusTimestamp = min(max(timestamp, 0.0), duration)
|
||||
}
|
||||
|
||||
let status = MediaPlayerStatus(generationTimestamp: CACurrentMediaTime(), duration: duration, dimensions: CGSize(), timestamp: statusTimestamp, baseRate: self.baseRate, seekId: self.seekId, status: .buffering(initial: false, whilePlaying: action == .play, progress: 0.0, display: true), soundEnabled: self.enableSound)
|
||||
self.playerStatus.set(.single(status))
|
||||
let _ = self.playerStatusValue.swap(status)
|
||||
} else {
|
||||
let duration = seekState?.duration ?? 0.0
|
||||
let status = MediaPlayerStatus(generationTimestamp: CACurrentMediaTime(), duration: duration, dimensions: CGSize(), timestamp: min(max(timestamp, 0.0), duration), baseRate: self.baseRate, seekId: self.seekId, status: .buffering(initial: false, whilePlaying: action == .play, progress: 0.0, display: true), soundEnabled: self.enableSound)
|
||||
|
||||
let statusTimestamp: Double
|
||||
if duration == 0.0 {
|
||||
statusTimestamp = max(timestamp, 0.0)
|
||||
} else {
|
||||
statusTimestamp = min(max(timestamp, 0.0), duration)
|
||||
}
|
||||
|
||||
let status = MediaPlayerStatus(generationTimestamp: CACurrentMediaTime(), duration: duration, dimensions: CGSize(), timestamp: statusTimestamp, baseRate: self.baseRate, seekId: self.seekId, status: .buffering(initial: false, whilePlaying: action == .play, progress: 0.0, display: true), soundEnabled: self.enableSound)
|
||||
self.playerStatus.set(.single(status))
|
||||
let _ = self.playerStatusValue.swap(status)
|
||||
}
|
||||
@ -974,7 +990,13 @@ private final class MediaPlayerContext {
|
||||
if case .seeking(_, timestamp, _, _, _, _) = self.state {
|
||||
reportTimestamp = timestamp
|
||||
}
|
||||
let status = MediaPlayerStatus(generationTimestamp: statusTimestamp, duration: duration, dimensions: CGSize(), timestamp: min(max(reportTimestamp, 0.0), duration), baseRate: self.baseRate, seekId: self.seekId, status: playbackStatus, soundEnabled: self.enableSound)
|
||||
let statusTimestamp: Double
|
||||
if duration == 0.0 {
|
||||
statusTimestamp = max(reportTimestamp, 0.0)
|
||||
} else {
|
||||
statusTimestamp = min(max(reportTimestamp, 0.0), duration)
|
||||
}
|
||||
let status = MediaPlayerStatus(generationTimestamp: CACurrentMediaTime(), duration: duration, dimensions: CGSize(), timestamp: statusTimestamp, baseRate: self.baseRate, seekId: self.seekId, status: playbackStatus, soundEnabled: self.enableSound)
|
||||
self.playerStatus.set(.single(status))
|
||||
let _ = self.playerStatusValue.swap(status)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user