avplayerviewcontroller

Unable to simultaneously satisfy constraints Warnings with AVPlayerViewController embedded in storyboard

依然范特西╮ 提交于 2019-11-27 21:50:30
I'm trying to set up an AVPlayerViewController completely through storyboards by embedding in a separate View Controller. Steps: Create Single View Application in Xcode. Embed VC in navigation Controller. Add toolbar at the bottom.(pinned to superView (Leading, Trailing, Bottom Layout Guide, Height(44)). Add container View in parent View Controller.(pinned to superView (Leading, Trailing), Top Layout Guide, toolbar Top). Remove the default View Controller that comes with container view. Drag AV Player View Controller object from Object Library. Connect embed segue from Container View to AV

Done button click event in AVPlayerViewController

本秂侑毒 提交于 2019-11-27 15:07:36
I want to play local video in AVPlayerViewController but did not find click event of Done button. My video is able to play in AVPlayerViewController but I did not find next button , previous button and done button click event. Officially there is no Done Button click event, a engineer from Apple said about it here . As for my research, I found out that there is one but really indirect way to get an event if Done Button was clicked. I found out that the only variable of AVPlayerViewController, which is changing when done button is clicked is AVPlayerViewController.view.frame . First of all view

Play a video from Youtube in a AVPlayerViewController in Swift [duplicate]

≡放荡痞女 提交于 2019-11-26 23:25:03
问题 This question already has an answer here: How to embed a Youtube video into my app? 6 answers Okay so I'm looking to play film trailers in my app. The user will press a button, and then it plays the video. I have added the import AVKit and import AVFoundation lines to my file. This is the code I have so far for making the video play: @IBAction func playTrailerPressed(sender: AnyObject) { let videoURL = NSURL(string: "https://youtu.be/d88APYIGkjk") let player = AVPlayer(URL: videoURL!) let

No AVPlayer Delegate? How to track when song finished playing? Objective C iPhone development

≯℡__Kan透↙ 提交于 2019-11-26 19:48:05
I've looked around but I can't find a delegate protocol for the AVPlayer class . What gives? I'm using its subclass, AVQueuePlayer , to play an array of AVPlayerItems , each loaded from a URL. Is there any way I can call a method when a song finishes playing? Notably at the end of the queue? And if that's not possible, is there any way I could call a method when the song STARTS playing, after buffering? I'm trying to get a loading icon in there but it turns the icon off before the music actually begins, even though it's after the [audioPlayer play] action. Yes, the AVPlayer class does not have

How to play a local video with Swift?

这一生的挚爱 提交于 2019-11-26 14:04:22
I have a short mp4 video file that I've added to my current Xcode6 Beta project. I want to play the video in my app. After hours searching, I can't find anything remotely helpful. Is there a way to accomplish this with Swift or do you have to use Objective-C? Can I get pointed in the right direction? I can't be the only one wondering this. Sure you can use Swift! 1. Adding the video file Add the video (lets call it video.m4v ) to your Xcode project 2. Checking your video is into the Bundle Open the Project Navigator cmd + 1 Then select your project root > your Target > Build Phases > Copy

How to play a local video with Swift?

≡放荡痞女 提交于 2019-11-26 05:55:16
问题 I have a short mp4 video file that I\'ve added to my current Xcode6 Beta project. I want to play the video in my app. After hours searching, I can\'t find anything remotely helpful. Is there a way to accomplish this with Swift or do you have to use Objective-C? Can I get pointed in the right direction? I can\'t be the only one wondering this. 回答1: Sure you can use Swift! 1. Adding the video file Add the video (lets call it video.m4v ) to your Xcode project 2. Checking your video is into the

How to play video with AVPlayerViewController (AVKit) in Swift

旧街凉风 提交于 2019-11-26 01:04:56
问题 How do you play a video with AV Kit Player View Controller in Swift? override func viewDidLoad() { super.viewDidLoad() let videoURLWithPath = \"http://****/5.m3u8\" let videoURL = NSURL(string: videoURLWithPath) playerViewController = AVPlayerViewController() dispatch_async(dispatch_get_main_queue()) { self.playerViewController?.player = AVPlayer.playerWithURL(videoURL) as AVPlayer } } 回答1: Swift 3.x - 5.x Necessary: import AVKit , import AVFoundation AVFoundation framework is needed even if

How to play video with AVPlayerViewController (AVKit) in Swift

自古美人都是妖i 提交于 2019-11-25 23:42:32
How do you play a video with AV Kit Player View Controller in Swift? override func viewDidLoad() { super.viewDidLoad() let videoURLWithPath = "http://****/5.m3u8" let videoURL = NSURL(string: videoURLWithPath) playerViewController = AVPlayerViewController() dispatch_async(dispatch_get_main_queue()) { self.playerViewController?.player = AVPlayer.playerWithURL(videoURL) as AVPlayer } } Swift 3.x - 5.x Necessary: import AVKit , import AVFoundation AVFoundation framework is needed even if you use AVPlayer If you want to use AVPlayerViewController : let videoURL = URL(string: "https://clips