avkit

iPhone simulator plays video, real device won't

与世无争的帅哥 提交于 2019-12-02 01:04:01
I am building an app in Swift on Xcode 7.2 I added a video to my ViewController. Here's the code: import UIKit import AVKit import AVFoundation class GymViewController: UIViewController { var playerViewController = AVPlayerViewController() var playerView = AVPlayer() let fileFemaleURL = NSURL(fileURLWithPath:"/Users/marienkoen/Documents/AppDevelopment/ROZsport/ROZsport/GymFemale-2434.m4v") override func viewDidLoad() { super.viewDidLoad() } @IBAction func playButtonPressed(sender: AnyObject) { playerView = AVPlayer(URL: fileFemaleURL) playerViewController.player = playerView self

AVPlayer not playing m3u8 from local file

谁说我不能喝 提交于 2019-12-01 09:37:20
I am trying to get AVPlayer to play a m3u8 playlist that is a local file. I have narrowed this down to a simple test case using one of Apple's sample playlists: https://tungsten.aaplimg.com/VOD/bipbop_adv_fmp4_example/master.m3u8 If i play this playlist from the remote url, AVPlayer plays this fine. However, if i download this playlist to a local file, and then hand AVPlayer the local file URL, AVPlayer will not play it. It just shows the crossed out play symbol. Interestingly enough, this can be duplicated with Safari as well. Safari will play the remote playlist but not the local file. Also

Square video using AVFoundation

家住魔仙堡 提交于 2019-11-30 16:43:25
I followed the given tutorial to create a custom square video recording camera. http://www.netwalk.be/article/record-square-video-ios I am able to export a square video from this, but when i try to play the newly exported file using the url it does not play. For the original url ,i tried was working fine and playing properly. I opened the documents directory of the phone and found that the video was getting cropped and a file was created but playing the video on quicktimeplayer it was appearing very slow and seemed to play in frame by frame manner i.e. too slow. (Don't know whether it was an

AVPlayerViewController using audio-only AVPlayer

只谈情不闲聊 提交于 2019-11-28 11:26:50
Just starting out with AVKit, and I'm trying to play some audio. It would be nice to use the new AVPlayerViewController detailed in Mastering Modern Media Playback so that I have a ready-made play/pause/seek UI. I basically have a storyboard with a container view which has an embed segue to the AVPlayerViewController. Then I use: override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if (segue.identifier == "embedAudio") { var playerViewController:AVPlayerViewController = segue.destinationViewController as AVPlayerViewController playerViewController.player = AVPlayer(URL

AVPlayer stops playing video after buffering

耗尽温柔 提交于 2019-11-28 07:51:18
When I load a video from the internet (10-40MB large) I am unable to provide a smooth playing experience. My AVPlayer either loads the whole video and then plays it, or plays 1s, buffers and then just stops playing. I tried endless libraries, buffer-observer methods, and tutorials. Nothing seems to help. . . . self.makeLoaderVisible() let playerItem = AVPlayerItem(url: url) playerItem.addObserver(self, forKeyPath: "playbackBufferEmpty", options: .new, context: nil) playerItem.addObserver(self, forKeyPath: "playbackLikelyToKeepUp", options: .new, context: nil) playerItem.addObserver(self,

how to fetch resolution supported by video .m38u file url in swift

陌路散爱 提交于 2019-11-28 04:46:24
问题 I am currently working on HTTP Live streaming video with AVPlayerViewController / AVPlayer I am playing a video with .m3u8 file supported It is playing fine but my question is that can I have the data of video like I have to set 4 types of resolution while generating the .m3u8 file.. , I can varies the resolution at my end point now the question is how to get the all values which i have setup at my endpoint. I am play this is in android also and using Track i am able to fetch all the video

AVPlayerViewController using audio-only AVPlayer

旧巷老猫 提交于 2019-11-27 06:07:45
问题 Just starting out with AVKit, and I'm trying to play some audio. It would be nice to use the new AVPlayerViewController detailed in Mastering Modern Media Playback so that I have a ready-made play/pause/seek UI. I basically have a storyboard with a container view which has an embed segue to the AVPlayerViewController. Then I use: override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if (segue.identifier == "embedAudio") { var playerViewController:AVPlayerViewController

AVPlayer stops playing video after buffering

痞子三分冷 提交于 2019-11-27 04:27:11
问题 When I load a video from the internet (10-40MB large) I am unable to provide a smooth playing experience. My AVPlayer either loads the whole video and then plays it, or plays 1s, buffers and then just stops playing. I tried endless libraries, buffer-observer methods, and tutorials. Nothing seems to help. . . . self.makeLoaderVisible() let playerItem = AVPlayerItem(url: url) playerItem.addObserver(self, forKeyPath: "playbackBufferEmpty", options: .new, context: nil) playerItem.addObserver(self

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