Cabbage icon indicating copy to clipboard operation
Cabbage copied to clipboard

black screen when the audio overlay goes to finish

Open ahmedsafadii opened this issue 4 years ago • 2 comments

            let voiceResource = AVAssetTrackResource(asset: asset)
            
            if videoTimelineView.duration <= ((voiceOvers[currentVoiceOver]?.startTime ?? 0.0) + asset.duration.seconds) {
                voiceResource.selectedTimeRange = CMTimeRange(start: .zero, duration: CMTime(seconds: asset.duration.seconds, preferredTimeScale: 10))
            }
            item.identifier = voiceOvers[currentVoiceOver]?.name ?? ""
            item.startTime = CMTime(seconds: voiceOvers[currentVoiceOver]?.startTime ?? 0.0, preferredTimescale: 10)

ahmedsafadii avatar Aug 18 '21 07:08 ahmedsafadii

your issue maybe because the audio time is bigger than the video time, you can try to cut the audio time or extend the video time

vitoziv avatar Aug 19 '21 02:08 vitoziv

@vitoziv thank you for answering, as you can see here I already do the selected time range

            if videoTimelineView.duration <= ((voiceOvers[currentVoiceOver]?.startTime ?? 0.0) + asset.duration.seconds) {
                voiceResource.selectedTimeRange = CMTimeRange(start: .zero, duration: CMTime(seconds: asset.duration.seconds, preferredTimeScale: 10))
            }

in case the audio is bigger than video, but I would say that's it's not because sometimes it's works and sometime I get black,

you need to know that i had more than one audio recorded and all have startime, but the only voice which reach the end can make the black issue

ahmedsafadii avatar Aug 19 '21 06:08 ahmedsafadii