avplayerviewcontroller

defining view frame size for AV Player ViewController in ios

家住魔仙堡 提交于 2019-12-04 13:56:00
How does one play a video as a background in iOS? I followed this question How to play a local video with Swift? , but AV Player ViewController is a controller and doesn't let me decide where and how big the view containing video is. It always takes some predefined values. I've got this working for a project that I've done but not with an AVPlayerViewController - just a plain AVPlayer that I add to a view's layer. I have a collection view but you can just insert the video on a layer wherever you want. Try something like this: NSString *filepath = [[NSBundle mainBundle] pathForResource:@"my

AVPlayer not playing audio - iOS 9, Objective - C

蓝咒 提交于 2019-12-04 11:35:26
问题 I am trying to play audio from a URL in my app. Everything happens as expected in iOS 8 (simulator and physical devices). For iOS 9, it works in simulator but on device, the audio simply does not play. The streaming appears, if I click on play, the progress bar also shows that audio is getting loaded and playing but the sound does not come. This issue is happening in iOS 9 physical device. It works totally fine with iOS 8 physical device. I created a simple button. On clicking on button, the

AVPlayerLayer shows black screen but sound is working

混江龙づ霸主 提交于 2019-12-04 04:41:34
问题 Im trying to display a local recorded video in a AVPlayerLayer which works sometimes . I can hear the audio from the recorded video but can't see the video. Sometimes both video and audio is working, sometimes only audio. I've tried both with a AVPlayerLayer and AVPlayerViewController but the same issue occurs in both cases. So it's not because of the frames being wrong. Example code AVPlayerViewController : let player = AVPlayer(url: url) let playerController = AVPlayerViewController()

AVPlayerViewController in UICollectionViewCell bug?

£可爱£侵袭症+ 提交于 2019-12-03 22:28:46
In my UICollectionView i have a cell. This is my cellForItemAtIndexPath func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { var videoCell = collectionView.dequeueReusableCellWithReuseIdentifier("cellVideo", forIndexPath: indexPath) as? CollectionViewCell let post = self.arrayOfDetails[indexPath.row] var myUrl = post.image // post.image is image url let fileUrl = NSURL(string: post.image) aPlayer = AVPlayer(URL: fileUrl) moviePlayerController.player = aPlayer moviePlayerController.view.frame = CGRectMake(8, 8, videoCell!

AVPlayer crash when resizing window during fullscreen while hotspotting

戏子无情 提交于 2019-12-03 11:32:02
I'm coding on an app where uses can watch a wide array of videos. I open the video in fullscreen on button tap and the user is able to use the playback controls to resize the window. The issue I'm having is that when the user is sharing his internet through hotspot there is a blue bar at the top of the app. When resizing the window at this point will cause a crash in the AVKit framework (I believe). Using Swift 2.3, Xcode 7.3.1. My phone, iPhone 6s, uses iOS 10 and I've also tried it on iOS 9 iPhone 6 Plus, same issue. The crash: Terminating app due to uncaught exception

AVPlayer not playing audio - iOS 9, Objective - C

会有一股神秘感。 提交于 2019-12-03 08:12:06
I am trying to play audio from a URL in my app. Everything happens as expected in iOS 8 (simulator and physical devices). For iOS 9, it works in simulator but on device, the audio simply does not play. The streaming appears, if I click on play, the progress bar also shows that audio is getting loaded and playing but the sound does not come. This issue is happening in iOS 9 physical device. It works totally fine with iOS 8 physical device. I created a simple button. On clicking on button, the AVPlayerViewController is loaded and AVPlayer is initialized with the given URL. The code is following:

AVPlayer.play() in UITableViewCell briefly blocks UI

僤鯓⒐⒋嵵緔 提交于 2019-12-03 03:42:27
I’m trying add inline videos to my UITableViewCells a la Instagram, Twitter, Vine…etc. I’m testing out the UI with a local video file using AVPlayerController and a custom cell (see sample code below). I wait for the status of the AVPlayer to be ReadyToPlay and then play the video. The issue is that when scrolling on the tableView the UI freezes for a fraction of section whenever a video cell is loaded which makes the app seem clunky. This effect is made worse when there are multiple video cells in a row. Any thoughts and help would be greatly appreciated TableView Code: func tableView

How to play video with AVPlayerViewController (AVKit) in Swift

匿名 (未验证) 提交于 2019-12-03 01:26:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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 - 4.x Necessary: import AVKit , import AVFoundation AVFoundation framework is needed even if you use AVPlayer If you want to use

视频播放之一 AVPlayerViewController

匿名 (未验证) 提交于 2019-12-03 00:32:02
在iOS8中,iOS开发框架中引入了一个新的视频框架AVKit,其中提供了视频开发类AVPlayerViewController用于在应用中嵌入播放视频的控件。 iOS9系统后,iPad Air正式开始支持多任务与画中画的分屏功能,所谓画中画,即是用户可以将当前播放的视频缩小放在屏幕上同时进行其他应用程序的使用。 这个革命性的功能将极大的方便用户的使用。开发者使用AVPlayerViewController可以十分方便的实现视频播放的功能并在一些型号的iPad上集成画中画的功能。 注意事项: * AVPlayerViewController提供了默认的可视化控制界面,要使用AVPlayerViewController需导入AVKit.h。 * AVPlayerViewController整合了一个完整的播放器,可以作为控制器进行操作显示。 * AVPlayerViewController可以支持播放本地及网络视频文件,支持以下格式:.mov、.mp4、.mpv、.3gp。 * 在循环播放视频的时,MPMoviePlayerController可以直接设置循环播放模式self.player.repeatMode = MPMovieRepeatModeOne;而AVPlyer和AVPlayerViewController都是需要添加通知去监测播放完成和后台切换到前台这个操作。

How to play video with cookies content in iOS using AVPlayer in Swift?

…衆ロ難τιáo~ 提交于 2019-12-02 08:53:20
I have used the below implementation to play a video with cookies content from the server, but it shows play icon with cross line. I have refer the link and do following implementation in swift. but I didn't get any output :( func showVideo(url: String) { let videoURL = NSURL(string: url) var cookiesArray = [HTTPCookie]() guard let cookieArray = UserDefaults.standard.array(forKey: Constants.Object.kCookie) as? [[HTTPCookiePropertyKey: Any]] else { return } for cookieProperties in cookieArray { if let cookie = HTTPCookie(properties: cookieProperties) { cookiesArray.append(cookie) } } let