Shift AVPlayer captions when subview overlaps them
For what it's worth, this is possible. You need to access the AVPlayer's current item and set an AVTextStyleRule for it.
// currentPlayer is our instance of the AVPlayer
if let currItem = currentPlayer?.currentItem,
let rule = AVTextStyleRule(textMarkupAttributes:[kCMTextMarkupAttribute_OrthogonalLinePositionPercentageRelativeToWritingDirection as String: 93]) {
// 93% from the top of the video
currItem.textStyleRules = [rule]
}
How to remove the live text from an AVPlayer
You can disable it by using a special flag allowsVideoFrameAnalysis
developer.apple.com
let player = AVPlayer(url: url)
let playerViewController = AVPlayerViewController()
playerViewController.player = player
if #available(iOS 16.0, *) {
playerViewController.allowsVideoFrameAnalysis = false
}
Related Topics
How to Update Constraints Programmatically
Swift Get Specific Value from Firebase Database
Disable Vertical Scroll in Uiscrollview Swift
How to Use a Generic Class Without the Type Argument in Swift
Pass Data from View Controller to Child Controller in Swift
Uisearchcontroller Searchbar Delegate Not Working
Swift Check If 3D Touch Is Possible
Present Specific View Controller in Didreceiveremotenotification with Swift
Swift 3 - Nsfetchrequest Distinct Results
String to Double in Xcode 6's Swift
iOS with Parse. Pfuser.Currentuser() Not Getting Cached. Returns Nil After App Restart
Swift, Google Map Fit Bound for All the Markers
Uidropinteractiondelegate Performdrop Not Called
Uibutton Subclass @Ibaction Not Working
Uidocumentinteractioncontroller() Swift
What Is Correct Way to Notify View Controller from Appdelegate