Various fixes

This commit is contained in:
Ilya Laktyushin
2023-09-17 23:48:53 +04:00
parent 1eafdc2ae0
commit c501e11a32
4 changed files with 62 additions and 26 deletions

View File

@@ -1351,15 +1351,21 @@ final class MediaEditorScreenComponent: Component {
audioOffsetUpdated: { [weak mediaEditor] offset, done in
if let mediaEditor {
mediaEditor.setAudioTrackOffset(offset, apply: done)
if done {
if !isAudioOnly {
mediaEditor.play()
if isAudioOnly {
let offset = (mediaEditor.values.audioTrackOffset ?? 0.0)
let start = (mediaEditor.values.audioTrackTrimRange?.lowerBound ?? 0.0)
if done {
mediaEditor.seek(offset + start, andPlay: true)
} else {
mediaEditor.seek(offset + start, andPlay: false)
mediaEditor.stop()
}
} else {
if isAudioOnly {
mediaEditor.seek(offset + (mediaEditor.values.audioTrackTrimRange?.lowerBound ?? 0.0), andPlay: false)
if done {
mediaEditor.play()
} else {
mediaEditor.stop()
}
mediaEditor.stop()
}
}
},