mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Various fixes
This commit is contained in:
@@ -287,7 +287,6 @@ final class YoutubeEmbedImplementation: WebEmbedImplementation {
|
||||
}
|
||||
|
||||
let _ = download
|
||||
let _ = failed
|
||||
|
||||
if let position = position {
|
||||
if self.ignoreEarlierTimestamps {
|
||||
@@ -307,8 +306,14 @@ final class YoutubeEmbedImplementation: WebEmbedImplementation {
|
||||
}
|
||||
|
||||
if let updateStatus = self.updateStatus, let playback = playback, let duration = duration {
|
||||
let playbackStatus: MediaPlayerPlaybackStatus
|
||||
switch playback {
|
||||
if let failed, failed {
|
||||
self.status = MediaPlayerStatus(generationTimestamp: self.status.generationTimestamp, duration: 0.0, dimensions: self.status.dimensions, timestamp: 0.0, baseRate: 0.0, seekId: self.status.seekId, status: .playing, soundEnabled: false)
|
||||
updateStatus(self.status)
|
||||
|
||||
self.onPlaybackStarted?()
|
||||
} else {
|
||||
let playbackStatus: MediaPlayerPlaybackStatus
|
||||
switch playback {
|
||||
case 0:
|
||||
if newTimestamp > Double(duration) - 1.0 {
|
||||
self.isPlaying = false
|
||||
@@ -325,17 +330,18 @@ final class YoutubeEmbedImplementation: WebEmbedImplementation {
|
||||
playbackStatus = .buffering(initial: !self.started, whilePlaying: self.isPlaying, progress: 0.0, display: false)
|
||||
default:
|
||||
playbackStatus = .buffering(initial: true, whilePlaying: true, progress: 0.0, display: false)
|
||||
}
|
||||
|
||||
if case .playing = playbackStatus, !self.started {
|
||||
self.started = true
|
||||
print("YT started in \(CFAbsoluteTimeGetCurrent() - self.benchmarkStartTime)")
|
||||
}
|
||||
|
||||
self.onPlaybackStarted?()
|
||||
if case .playing = playbackStatus, !self.started {
|
||||
self.started = true
|
||||
print("YT started in \(CFAbsoluteTimeGetCurrent() - self.benchmarkStartTime)")
|
||||
|
||||
self.onPlaybackStarted?()
|
||||
}
|
||||
|
||||
self.status = MediaPlayerStatus(generationTimestamp: self.status.generationTimestamp, duration: Double(duration), dimensions: self.status.dimensions, timestamp: newTimestamp, baseRate: self.status.baseRate, seekId: self.status.seekId, status: playbackStatus, soundEnabled: true)
|
||||
updateStatus(self.status)
|
||||
}
|
||||
|
||||
self.status = MediaPlayerStatus(generationTimestamp: self.status.generationTimestamp, duration: Double(duration), dimensions: self.status.dimensions, timestamp: newTimestamp, baseRate: self.status.baseRate, seekId: self.status.seekId, status: playbackStatus, soundEnabled: true)
|
||||
updateStatus(self.status)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user