avplayer

Add Trick Play feature with AVPlayerViewController in Swift

北城以北 提交于 2019-12-11 10:38:47
问题 I implemented a video player function with AVPlayer in Swift 3. Currently, I can play the video well. I would like to add the feature of " Trick Play " with the speed of 2x,3x,4x . However, I didn't find anything googling. Can anyone help me please? 回答1: Try playerViewController.player!.rate = 2 // 3, 4 etc 来源: https://stackoverflow.com/questions/42973856/add-trick-play-feature-with-avplayerviewcontroller-in-swift

Unable to export AVPlayerItem

为君一笑 提交于 2019-12-11 08:15:41
问题 I'm using AVQueuePlayer to do playback of a list of videos in our app. I'm trying to cache the videos that are played by AVQueuePlayer so that the video doesn't have to be downloaded each time. So, after the video finishes playing, I attempt to save the AVPlayerItem into disk so next time it's initialized with a local URL. I've tried to achieve this through two approaches: Use AVAssetExportSession Use AVAssetReader and AVAssetWriter. 1) AVAssetExportSession approach This approach works like

How to crop audio in ios

喜你入骨 提交于 2019-12-11 08:06:01
问题 I'm wondering how can I crop some part of voice and audio and make them together in single file using Objective-C code. Should I use C++ library? Want to convert avaudiorecorder to data and choose some parts. 来源: https://stackoverflow.com/questions/13604879/how-to-crop-audio-in-ios

I'm trying to use AVQueuePlayer to create a seamless audio loop, however, I don't know why there is a small silent pause between loops?

为君一笑 提交于 2019-12-11 06:49:44
问题 I have a simple audio file in .wav format (the audio file is cut perfectly to loop). I've tried different methods to loop it. My first attempt was simply using AVPlayer and NSNotification to detect when audioItem ended to seek time at zero and play again. However, there was clearly a gap. I've been looking at different solutions online, and found people using AVQueuePlayer to do a switching: Looping AVPlayer seamlessly However, when implemented, this still produces a gap. Here's my current

Stop AVPlayer from playing in tableviewcell

左心房为你撑大大i 提交于 2019-12-11 06:26:54
问题 I'm using AVPlayer for displaying video in my TableViewCell . It is playing in TableViewCell , but the problem is that I'm not able to stop it. I've used this Code to play video in cellforRow avPlayer = AVPlayer(url: videoURL! as URL) playerLayer = AVPlayerLayer(player: avPlayer) playerLayer.frame = CGRect(x: cell.videoview.frame.origin.x, y: cell.videoview.frame.origin.x, width:cell.videoview.frame.size.width, height: cell.videoview.frame.size.height) cell.videoview.layer.addSublayer

Why is imagePickerController.mediaTypes = [kUTTypeMovie as String] including Live Photos as Bounce or Loop Effect as Video?

不问归期 提交于 2019-12-11 05:49:34
问题 I'm using the UIImagePicker to pick only videos from my library and I set my media type to: imagePicker.mediaTypes = [kUTTypeMovie as String] I noticed that when the library is presented, even though I expect only videos, if there is a live photo in the library with a Bounce or Loop effect, it shows up also. If I take that same photo and switch it's effect to Live or Long Exposure it will no longer show up in the library. If I switch it back to Bounce or Loop it reappears. I've tried both the

AVQueuePlayer sometimes moves to the next AVPlayerItem in its items queue without sending AVPlayerItemDidPlayToEndTimeNotification

雨燕双飞 提交于 2019-12-11 05:30:57
问题 I'm using AVQueuePlayer to play a couple of streams in order. But often the AVQueuePlayer decides to skip to the next song without sending AVPlayerItemDidPlayToEndTimeNotification . Also no error is logged in the player. The streaming protocol used is Http Live Streaming. Could this behavoir be due to a problem with the streams? Has anyone else encountered it? 回答1: Have you checked the status of the item that didn't play? It may have failed, for some reason. 来源: https://stackoverflow.com

Accounting for current time when panning to scrub video

假如想象 提交于 2019-12-11 05:26:41
问题 This is the code related to panning/ scrubbable video. The current issue occurs when the second swipe gesture has a delta from the last position of the first swipe. In other words this code needs to take into account the current time of the video to prevent the skip. ``` func didSwipe(panGR: UIPanGestureRecognizer) { let translation = panGR.translationInView(self.view) var horizontalTranslation = Float(translation.x) let durationInSeconds = Float(CMTimeGetSeconds(self.playerView.player.player

How can I sample an audio stream on iOS for visualization regardless of the audio source?

≯℡__Kan透↙ 提交于 2019-12-11 05:14:05
问题 I'm interested in creating an iOS audio visualizer, not one that uses AVPlayer or any other similar derivatives, but one that is able to parse through an audio signal and create an audio visualization regardless of the application that is playing it. For instance, if Spotify is playing, or iTunes is playing. From whatI understand, you don't have access to that stream pragmatically unless the application specifically allows it. Another approach I was thinking of was to use the microphone, but

Disable gesture recognizer in AVPlayerViewController

帅比萌擦擦* 提交于 2019-12-11 04:47:55
问题 In AVPlayerViewController there is a feature for stopping the playback of a video and closing the AVPlayerViewController by swiping its view. I want to disable this feature. I guess I need to disable a gesture recognizer!? But I don’t know how to do this for the player. 回答1: I recently stumbled upon a similar problem. You can access the gesture recognizers from the contentView of AVPlayerViewController . If you wanted to keep only the tap gesture recognizer, you might want to use a function