mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-29 03:21:29 +00:00
Various fixes
This commit is contained in:
parent
bd03935b42
commit
fce5f01e66
@ -304,7 +304,10 @@ final class MediaEditorRenderer: TextureConsumer {
|
||||
self.willRenderFrame()
|
||||
|
||||
self.currentPixelBuffer = pixelBuffer
|
||||
if additionalPixelBuffer == nil && self.currentAdditionalPixelBuffer != nil {
|
||||
} else {
|
||||
self.currentAdditionalPixelBuffer = additionalPixelBuffer
|
||||
}
|
||||
if render {
|
||||
if self.previousPresentationTimestamp == pixelBuffer.timestamp {
|
||||
self.didRenderFrame()
|
||||
|
||||
@ -1910,61 +1910,6 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if case .video = subject {
|
||||
self.playbackPositionDisposable = (mediaEditor.position
|
||||
|> deliverOnMainQueue).start(next: { [weak self] position in
|
||||
if let self {
|
||||
self.updateVideoPlaybackPosition(position: position)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private var additionalIsMainstage = false
|
||||
private func updateVideoPlaybackPosition(position: CGFloat) {
|
||||
guard let subject = self.subject, case let .video(_, _, _, _, _, _, _, timestamps, _) = subject, !timestamps.isEmpty else {
|
||||
return
|
||||
}
|
||||
var currentIsFront = false
|
||||
for (isFront, timestamp) in timestamps {
|
||||
if position < timestamp {
|
||||
break
|
||||
}
|
||||
currentIsFront = isFront
|
||||
}
|
||||
|
||||
self.additionalIsMainstage = currentIsFront
|
||||
self.updateMainStageVideo()
|
||||
}
|
||||
|
||||
private func updateMainStageVideo() {
|
||||
guard let mainEntityView = self.entitiesView.getView(where: { $0 is DrawingMediaEntityView }) as? DrawingMediaEntityView, let mainEntity = mainEntityView.entity as? DrawingMediaEntity else {
|
||||
return
|
||||
}
|
||||
|
||||
let additionalEntityView = self.entitiesView.getView(where: { view in
|
||||
if let stickerEntity = view.entity as? DrawingStickerEntity, case .video = stickerEntity.content {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}) as? DrawingStickerEntityView
|
||||
|
||||
var animated = true
|
||||
if mainEntity.scale != 1.0 || mainEntity.rotation != 0.0 || mainEntity.position != CGPoint(x: storyDimensions.width / 2.0, y: storyDimensions.height / 2.0) {
|
||||
animated = false
|
||||
}
|
||||
|
||||
let _ = animated
|
||||
|
||||
if self.additionalIsMainstage {
|
||||
mainEntityView.additionalView = additionalEntityView?.videoView
|
||||
additionalEntityView?.mainView = mainEntityView.previewView
|
||||
} else {
|
||||
mainEntityView.additionalView = nil
|
||||
additionalEntityView?.mainView = nil
|
||||
}
|
||||
}
|
||||
|
||||
override func didLoad() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user