avplayer

how to play a video in UIView swift?

社会主义新天地 提交于 2019-12-21 11:39:31
问题 I have a video which I want to download from a server and stream it in a fixed view. I've set a UIView in my storyboard with fixed constraints, and here is what I've done in code: @IBOutlet weak var videoView: UIView! var player: AVPlayer! var avpController = AVPlayerViewController() And in my viewDidLoad I've done this: let url = URL(string:myURL) player = AVPlayer(url: url!) avpController.player = player avpController.videoGravity = AVLayerVideoGravity.resizeAspect.rawValue self

Why AVPlayer downloading first instead live streaming?

有些话、适合烂在心里 提交于 2019-12-21 09:26:29
问题 First time I am working with AVPlayer and I want to play a mp3 file using HTTP request with live streaming. I use AVPlayer that is working fine to play mp3 files, but the problem is AVPlayer needs to download the mp3 first then play it. I don't know why AVPlayer downloads the file and then play it instead of live playing. My Xcode 8.2.1 and I am using Swift 3. Here is my code snippet. var audioPlayer = AVPlayer() var avplayerItem : AVPlayerItem? override func viewDidLoad() { super.viewDidLoad

AVPlayer replaceCurrentItemWithPlayerItem not working on iOS 4.3.3+

断了今生、忘了曾经 提交于 2019-12-21 07:07:07
问题 I have an audio player that I'm building using AVPlayer. Currently, I keep the player instance around and when I need to swap tracks (either from a manual selection or the track has reached the end) I create a new AVPlayerItem and I call replaceCurrentItemWithPlayerItem with the new item. According to the docs, replaceCurrentItemWithPlayerItem is an asynchronous operation, so I also observe the currentItem key path of the player. When that gets called, I tell my player to play. Here is the

Decrypt Media Files in chunks and play via AVPlayer

筅森魡賤 提交于 2019-12-21 05:32:16
问题 I have a mp4 video file which i am encrypting to save and decrypting to play via AVPlayer. Using CRYPTOSWIFT Library for encrypting/decrypting Its working fine when i am decrypting whole file at once but my file is quite big and taking 100% CPU usage and lot of memory. So, I need to decrypt encrypted file in chunks. I tried to decrypt file in chunks but its not playing video as AVPlayer is not recognizing decrypted chunk data maybe data is not stored sequentially while encrypting file. I have

Add iPod Equalizer effect using AVPlayer

心不动则不痛 提交于 2019-12-21 04:46:12
问题 We are developing a music app using AVPlayer, which is at the end stage. Everything was on track until we started working on iPod Equalizer applying effects to the currents song. We are able to fetch the built in Equalizers list when we apply the AudioUnitProperty we don't see any effects in songs. Your valuable response will be helpful to us. 回答1: You can most certainly accomplish various EQ effects using an AUGraph and AudioUnits in iOS. Basically, you would insert the effect between the

How does AVPlayer / AVPlayerItem inform my application about unreachable network failure?

依然范特西╮ 提交于 2019-12-21 04:38:09
问题 I’m using AVPlayer to implement a custom video player in an iOS application. To play video from the network I allocate a player: [[AVPlayer alloc] initWithURL:_URL]; Create an asset: AVURLAsset *asset = [AVURLAsset URLAssetWithURL:self.URL options:@{AVURLAssetPreferPreciseDurationAndTimingKey : @(YES)}]; load the playable key asynchronously: NSArray *keys = @[@"playable"]; [asset loadValuesAsynchronouslyForKeys:keys completionHandler:^{ dispatch_async(dispatch_get_main_queue(), ^{ for

iOS: AVPlayer video preloading

夙愿已清 提交于 2019-12-21 04:15:10
问题 I am using AVPlayer to play videos. The lenght of them is short, 2-5 second. They are played in a random order. The problem is, when changing video, and a new video starts to play, the device lags for a very short time, but i wan't the change to be fluid. Is there a way to preload videos with AVPlayer? 回答1: Try using AVQueuePlayer . I am assuming that what you described as a lag, in fact is the pre buffering delay. This should be minimized or actually entirely be gotten rid of when using

iOS 11 AVPlayer crash when KVO

爷,独闯天下 提交于 2019-12-21 03:58:06
问题 I got a weird crash when using AVPlayer to play a remote video. From the crash log on Fabric , the App crash on system thread ( com.apple.avfoundation.playerlayer.configuration ). The crash log is below: Crashed: com.apple.avfoundation.playerlayer.configuration 0 libsystem_kernel.dylib 0x1839ac2e8 __pthread_kill + 8 1 libsystem_pthread.dylib 0x183ac12f8 pthread_kill$VARIANT$mp + 396 2 libsystem_c.dylib 0x18391afbc abort + 140 3 libsystem_malloc.dylib 0x1839e3ce4 szone_size + 634 4 QuartzCore

AVPlayer crash when resizing window during fullscreen while hotspotting

*爱你&永不变心* 提交于 2019-12-21 03:52:50
问题 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

How to close previous AVPlayer and AVPlayerItem

喜你入骨 提交于 2019-12-21 02:34:09
问题 I'm making an iOS app in Swift that plays a video in a loop in a small layer in the top right corner of the screen which shows a video of specific coloured item. the user then taps the corresponding coloured item on the screen. when they do, the videoName variable is randomly changed to the next colour and the corresponding video is triggered. I have no problem raising, playing and looping the video with AVPlayer, AVPlayerItem as seen in the attached code. Where I'm stuck is that whenever the