मैं निम्नलिखित कोड के साथ अपने स्विफ्ट एप्लिकेशन (आईओएस 9) में वीडियो खेल रहा हूँ:AVPlayerController: पूर्ण स्क्रीन autolayout मुद्दों
let fileUrl = NSBundle.mainBundle().URLForResource("welcome", withExtension: ".mp4")
videoItem = AVPlayerItem(URL: fileUrl!)
videoPlayer = AVPlayer(playerItem: videoItem)
videoPlayer.addObserver(self, forKeyPath: "rate", options: [.New], context: nil)
videoPlayerController.player = videoPlayer
videoPlayerController.showsPlaybackControls = false
videoPlayerController.view.frame = CGRectMake(0, 0, playerView.frame.size.width, playerView.frame.size.height)
playerView.insertSubview(videoPlayerController.view, belowSubview: videoCoverView)
videoPlayerController.willMoveToParentViewController(self)
addChildViewController(videoPlayerController)
videoPlayerController.didMoveToParentViewController(self)
playerView.bringSubviewToFront(btnPlay)
let asset = AVAsset(URL: fileUrl!)
let imageGenerator = AVAssetImageGenerator(asset: asset)
let time = CMTime(seconds: asset.duration.seconds/2.0, preferredTimescale: 1)
do {
let imageRef = try imageGenerator.copyCGImageAtTime(time, actualTime: nil)
let coverImage = UIImage(CGImage: imageRef)
videoCoverView.image = coverImage
} catch {
}
videoPlayerController
AVPlayerViewController
का एक उदाहरण है। playerView
स्टोरीबोर्ड के माध्यम से जोड़ा गया है और इसमें ऑटोलायआउट सेटअप है। एवीप्लेयर व्यू कंट्रोलर के प्लेयर नियंत्रण के बाद मुझे प्लेयर नियंत्रणों के माध्यम से पूर्ण स्क्रीन मोड में जाने का प्रयास करने के बाद ऑटलोयआउट समस्याओं का सामना करना पड़ता है। यहां लॉग है जो मुद्रित हो जाता है।
2016-05-07 15:18:19.325 VoxTrain[2085:66307] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSAutoresizingMaskLayoutConstraint:0x7fb6a2a3f2c0 h=-&- v=-&- _UIBackdropContentView:0x7fb6a2a02310.width == _UIBackdropView:0x7fb6a053bf90.width>",
"<NSLayoutConstraint:0x7fb6a2992800 H:|-(14)-[UILabel:0x7fb6a2991220'Hi-Speed Scrubbing'] (Names: '|':_UIBackdropContentView:0x7fb6a2a02310)>",
"<NSLayoutConstraint:0x7fb6a2992850 H:[UILabel:0x7fb6a2991220'Hi-Speed Scrubbing']-(14)-| (Names: '|':_UIBackdropContentView:0x7fb6a2a02310)>",
"<NSLayoutConstraint:0x7fb6a29649a0 H:|-(0)-[_UIBackdropView:0x7fb6a053bf90] (Names: '|':UIView:0x7fb6a0549220)>",
"<NSLayoutConstraint:0x7fb6a298b8a0 H:[_UIBackdropView:0x7fb6a053bf90]-(0)-| (Names: '|':UIView:0x7fb6a0549220)>",
"<NSLayoutConstraint:0x7fb6a296f440 H:|-(0)-[UIView:0x7fb6a0549220] (Names: '|':AVAlphaUpdatingView:0x7fb6a053dae0)>",
"<NSLayoutConstraint:0x7fb6a296f490 H:[UIView:0x7fb6a0549220]-(0)-| (Names: '|':AVAlphaUpdatingView:0x7fb6a053dae0)>",
"<NSLayoutConstraint:0x7fb6a2a40cc0 'UIView-Encapsulated-Layout-Width' H:[AVAlphaUpdatingView:0x7fb6a053dae0(0)]>"
)
प्रारंभिक दृष्टिकोण के बाद, मैं गलत पर translatesAutoresizingMaskIntoConstraints
स्थापित करने के साथ videoPlayerController's
दृश्य पर autolayout
स्थापित करने के लिए कोशिश की। लेकिन मुद्दा अभी भी जारी है। मैं इन मुद्दों को कैसे ठीक कर सकता हूं?
डुप्लिकेट: http://stackoverflow.com/q/32860362/2415822 – JAL