mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Various fixes
This commit is contained in:
parent
27ae29592b
commit
06defbb3f6
@ -2590,6 +2590,10 @@ public class CameraScreenImpl: ViewController, CameraScreen {
|
||||
view.layer.animateScale(from: 1.0, to: 0.1, duration: 0.2)
|
||||
transition.setAlpha(view: view, alpha: 0.0)
|
||||
}
|
||||
if let view = self.componentHost.findTaggedView(tag: collageButtonTag) {
|
||||
view.layer.animateScale(from: 1.0, to: 0.1, duration: 0.2)
|
||||
transition.setAlpha(view: view, alpha: 0.0)
|
||||
}
|
||||
if let view = self.componentHost.findTaggedView(tag: zoomControlTag) {
|
||||
transition.setAlpha(view: view, alpha: 0.0)
|
||||
}
|
||||
@ -2680,6 +2684,10 @@ public class CameraScreenImpl: ViewController, CameraScreen {
|
||||
view.layer.animateScale(from: 0.1, to: 1.0, duration: 0.2)
|
||||
transition.setAlpha(view: view, alpha: 1.0)
|
||||
}
|
||||
if let view = self.componentHost.findTaggedView(tag: collageButtonTag) {
|
||||
view.layer.animateScale(from: 0.1, to: 1.0, duration: 0.2)
|
||||
transition.setAlpha(view: view, alpha: 1.0)
|
||||
}
|
||||
if let view = self.componentHost.findTaggedView(tag: zoomControlTag) {
|
||||
view.layer.animateScale(from: 0.1, to: 1.0, duration: 0.2)
|
||||
transition.setAlpha(view: view, alpha: 1.0)
|
||||
|
@ -216,6 +216,7 @@ public final class MediaEditorVideoExport {
|
||||
}
|
||||
|
||||
var skippingUpdate = false
|
||||
var initialized = false
|
||||
}
|
||||
private var additionalVideoOutput: [Int: VideoOutput] = [:]
|
||||
|
||||
@ -761,10 +762,32 @@ public final class MediaEditorVideoExport {
|
||||
for i in 0 ..< self.additionalVideoOutput.count {
|
||||
if let additionalVideoOutput = self.additionalVideoOutput[i] {
|
||||
if let mainTimestamp, mainTimestamp < additionalVideoOutput.startTime {
|
||||
|
||||
if !self.configuration.values.collage.isEmpty && !additionalVideoOutput.initialized {
|
||||
additionalVideoOutput.initialized = true
|
||||
if case let .videoOutput(videoOutput) = additionalVideoOutput.output {
|
||||
if let _ = videoOutput.copyNextSampleBuffer(), let sampleBuffer = videoOutput.copyNextSampleBuffer() {
|
||||
if let pixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) {
|
||||
additionalInput.append(.videoBuffer(VideoPixelBuffer(
|
||||
pixelBuffer: pixelBuffer,
|
||||
rotation: additionalVideoOutput.textureRotation,
|
||||
timestamp: .zero
|
||||
), additionalVideoOutput.rect))
|
||||
} else {
|
||||
additionalInput.append(nil)
|
||||
}
|
||||
} else {
|
||||
additionalInput.append(nil)
|
||||
}
|
||||
} else {
|
||||
additionalInput.append(nil)
|
||||
}
|
||||
} else {
|
||||
additionalInput.append(nil)
|
||||
}
|
||||
} else {
|
||||
if additionalVideoOutput.skippingUpdate {
|
||||
additionalVideoOutput.skippingUpdate = false
|
||||
additionalInput.append(nil)
|
||||
} else {
|
||||
switch additionalVideoOutput.output {
|
||||
case let .image(image):
|
||||
@ -787,6 +810,8 @@ public final class MediaEditorVideoExport {
|
||||
self.statusValue = .progress(Float(progress))
|
||||
updatedProgress = true
|
||||
}
|
||||
} else {
|
||||
additionalInput.append(nil)
|
||||
}
|
||||
if let mainComposeFramerate = self.mainComposeFramerate {
|
||||
let additionalFrameRate = round(additionalVideoOutput.frameRate / 30.0) * 30.0
|
||||
@ -794,7 +819,9 @@ public final class MediaEditorVideoExport {
|
||||
additionalVideoOutput.skippingUpdate = true
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
additionalInput.append(nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7747,8 +7747,53 @@ public final class MediaEditorScreenImpl: ViewController, MediaEditorScreen, UID
|
||||
let asset = AVURLAsset(url: NSURL(fileURLWithPath: path) as URL)
|
||||
exportSubject = .single(.video(asset: asset, isStory: true))
|
||||
case let .videoCollage(items):
|
||||
let _ = items
|
||||
exportSubject = .complete()
|
||||
var maxDurationItem: (Double, Subject.VideoCollageItem)?
|
||||
for item in items {
|
||||
switch item.content {
|
||||
case .image:
|
||||
break
|
||||
case let .video(_, duration):
|
||||
if let (maxDuration, _) = maxDurationItem {
|
||||
if duration > maxDuration {
|
||||
maxDurationItem = (duration, item)
|
||||
}
|
||||
} else {
|
||||
maxDurationItem = (duration, item)
|
||||
}
|
||||
case let .asset(asset):
|
||||
if let (maxDuration, _) = maxDurationItem {
|
||||
if asset.duration > maxDuration {
|
||||
maxDurationItem = (asset.duration, item)
|
||||
}
|
||||
} else {
|
||||
maxDurationItem = (asset.duration, item)
|
||||
}
|
||||
}
|
||||
}
|
||||
guard let (_, mainItem) = maxDurationItem else {
|
||||
fatalError()
|
||||
}
|
||||
let assetSignal: Signal<AVAsset, NoError>
|
||||
switch mainItem.content {
|
||||
case let .video(path, _):
|
||||
assetSignal = .single(AVURLAsset(url: NSURL(fileURLWithPath: path) as URL))
|
||||
case let .asset(asset):
|
||||
assetSignal = Signal { subscriber in
|
||||
PHImageManager.default().requestAVAsset(forVideo: asset, options: nil) { avAsset, _, _ in
|
||||
if let avAsset {
|
||||
subscriber.putNext(avAsset)
|
||||
subscriber.putCompletion()
|
||||
}
|
||||
}
|
||||
return EmptyDisposable
|
||||
}
|
||||
default:
|
||||
fatalError()
|
||||
}
|
||||
exportSubject = assetSignal
|
||||
|> map { asset in
|
||||
return .video(asset: asset, isStory: true)
|
||||
}
|
||||
case let .image(image, _, _, _):
|
||||
exportSubject = .single(.image(image: image))
|
||||
case let .asset(asset):
|
||||
|
Loading…
x
Reference in New Issue
Block a user