0
AVMutableComposition을 사용하여 비디오를 작성 중입니다. 다른 시간 간격으로 텍스트 오버레이를 추가해야합니다. i, e.AVMutableVideoComposition에 여러 텍스트 추가
- 표시 문자열 0 초에서 2 초 숨기기 이후
- 표시 문자열 "XYZ"1 초에서까지 1.5 초 숨기기 이후
- 표시 문자열 "QWE"2 초 내지 5 초
에 "ABC" 나는 텍스트 오버레이를 추가하기 위해 아래의 코드를 사용하고 있지만, 비디오를 통해 고정적으로 유지됩니다.
let parentLayer = CALayer()
parentLayer.frame = CGRect(x: 0, y: 0, width: size.width, height: size.height)
let videoLayer = CALayer()
videoLayer.frame = CGRect(x: 0, y: 0, width: size.width, height: size.height)
let subtitleText = CATextLayer()
subtitleText.font = font
subtitleText.frame = CGRect(x: 0, y: 100, width: size.width, height: 50)
subtitleText.string = "hhh"
subtitleText.alignmentMode = kCAAlignmentCenter
subtitleText.foregroundColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1).cgColor
subtitleText.displayIfNeeded()
parentLayer.addSublayer(videoLayer)
parentLayer.addSublayer(subtitleText)
모든 도움을 주실 수 있습니다.