Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

black screen when the audio overlay goes to finish #76

Open
ahmedsafadii opened this issue Aug 18, 2021 · 2 comments
Open

black screen when the audio overlay goes to finish #76

ahmedsafadii opened this issue Aug 18, 2021 · 2 comments

Comments

@ahmedsafadii
Copy link

            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)

@vitoziv
Copy link
Contributor

vitoziv commented Aug 19, 2021

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

@ahmedsafadii
Copy link
Author

ahmedsafadii commented Aug 19, 2021

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants