mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Fix media duration
This commit is contained in:
parent
1c455e4fec
commit
97937b45ea
@ -1109,7 +1109,7 @@ private final class SparseItemGridBindingImpl: SparseItemGridBinding, ListShimme
|
||||
var duration: Int32?
|
||||
var isMin: Bool = false
|
||||
if let file = selectedMedia as? TelegramMediaFile, !file.isAnimated {
|
||||
duration = file.duration.flatMap(Int32.init)
|
||||
duration = file.duration.flatMap { Int32(floor($0)) }
|
||||
isMin = layer.bounds.width < 80.0
|
||||
}
|
||||
layer.updateDuration(duration: duration, isMin: isMin, minFactor: min(1.0, layer.bounds.height / 74.0))
|
||||
|
@ -2016,7 +2016,7 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTransitio
|
||||
state = .download(messageTheme.mediaOverlayControlColors.foregroundColor)
|
||||
if let file = media as? TelegramMediaFile, !file.isVideoSticker {
|
||||
do {
|
||||
let durationString = file.isAnimated ? gifTitle : stringForDuration(playerDuration > 0 ? playerDuration : (file.duration.flatMap(Int32.init) ?? 0), position: playerPosition)
|
||||
let durationString = file.isAnimated ? gifTitle : stringForDuration(playerDuration > 0 ? playerDuration : (file.duration.flatMap { Int32(floor($0)) } ?? 0), position: playerPosition)
|
||||
if wideLayout {
|
||||
if isMediaStreamable(message: message, media: file), let fileSize = file.size, fileSize > 0 && fileSize != .max {
|
||||
state = automaticPlayback ? .none : .play(messageTheme.mediaOverlayControlColors.foregroundColor)
|
||||
|
@ -2272,7 +2272,7 @@ private class MessageContentNode: ASDisplayNode, ContentNode {
|
||||
mediaSize = dimensions.aspectFitted(mediaFitSize)
|
||||
mediaFrame = CGRect(origin: CGPoint(x: 3.0, y: 63.0), size: mediaSize)
|
||||
|
||||
mediaDuration = video.duration.flatMap(Int32.init) ?? 0
|
||||
mediaDuration = video.duration.flatMap { Int32(floor($0)) } ?? 0
|
||||
|
||||
if !wasInitialized {
|
||||
if self.isStatic {
|
||||
|
Loading…
x
Reference in New Issue
Block a user