mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Fix silent HLS videos
This commit is contained in:
parent
1081bdb31e
commit
20c9bad6a3
1 changed files with 19 additions and 0 deletions
|
|
@ -395,6 +395,10 @@ private final class ChunkMediaPlayerContext {
|
|||
}
|
||||
})
|
||||
} else {
|
||||
if let controlTimebase = self.loadedState.controlTimebase, !controlTimebase.isAudio {
|
||||
CMTimebaseSetTime(controlTimebase.timebase, time: CMTimeMakeWithSeconds(timestamp, preferredTimescale: 44000))
|
||||
}
|
||||
|
||||
self.isSeeking = false
|
||||
self.tick()
|
||||
}
|
||||
|
|
@ -592,6 +596,21 @@ private final class ChunkMediaPlayerContext {
|
|||
}
|
||||
timestamp = max(0.0, timestamp)
|
||||
|
||||
if let firstPart = self.loadedState.partStates.first, let mediaBuffers = firstPart.mediaBuffers, mediaBuffers.videoBuffer != nil, mediaBuffers.audioBuffer == nil {
|
||||
// No audio
|
||||
if self.audioRenderer != nil {
|
||||
self.audioRenderer?.renderer.stop()
|
||||
self.audioRenderer = nil
|
||||
|
||||
var timebase: CMTimebase?
|
||||
CMTimebaseCreateWithSourceClock(allocator: nil, sourceClock: CMClockGetHostTimeClock(), timebaseOut: &timebase)
|
||||
let controlTimebase = ChunkMediaPlayerControlTimebase(timebase: timebase!, isAudio: false)
|
||||
CMTimebaseSetTime(timebase!, time: CMTimeMakeWithSeconds(timestamp, preferredTimescale: 44000))
|
||||
|
||||
self.loadedState.controlTimebase = controlTimebase
|
||||
}
|
||||
}
|
||||
|
||||
//print("Timestamp: \(timestamp)")
|
||||
|
||||
var duration: Double = 0.0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue