avfoundation

Problem when attempting to loop AVPlayer (userCapturedVideo) seamlessly

十年热恋 提交于 2019-12-02 11:57:17
I have been looking around for a while on how to correctly accomplish this. I have looked here and here . And have used the top answer here , to try and accomplish this however for me the recorded video does not ever even begin to loop. The first frame shows up but does not play the video, thus I am wondering what's wrong. func fileOutput(_ output: AVCaptureFileOutput, didFinishRecordingTo outputFileURL: URL, from connections: [AVCaptureConnection], error: Error?) { if (error != nil) { print("Error recording movie11: \(error!.localizedDescription)") } else { isSettingThumbnail = false let

Paste String Data from UIPastboard

三世轮回 提交于 2019-12-02 10:39:40
I made an IOS app that using OCR to scan barcodes and copies the data to UserDefaults.standard.value(forKey: "barcodeId") as! String from a receipt. I'm trying to auto-populate the data taken from I've managed to pass the data to the element ID, But the data scanned using OCR doesn't populate the correct value. Below information from the console. NOTE: I've obscured the URL, Since It's a private URL. Optional(8.906010283900207e+17) is what I need to pass to the element ID on the webbased form. Thanks! Error Domain=WKErrorDomain Code=4 "A JavaScript exception occurred" UserInfo=

Exporting videos on iOS: understanding and setting frame duration property?

♀尐吖头ヾ 提交于 2019-12-02 10:07:43
In this tutorial on merging videos, the author sets the frame duration for the exported video to 30 FPS. 1) Instead of fixing the frame duration to 30 FPS, shouldn't the frame duration be tied to the frame duration of the videos getting merged? 2) When exporting videos, what are the pros/cons of using a different FPS for the exported video that differs from the source video(s)? Is this one way of speeding up export time at the expense of video quality? For instance, what if the source videos in the tutorial were captured at 24 FPS? We need to export videos on iOS, sometimes merging multiple

How to convert base64 into NSDATA in swift

限于喜欢 提交于 2019-12-02 10:06:51
问题 I am working on an iOS project. It stores audio on web server in the form of base64 string. When I request server to get base64 Strings for all audios and tried convert it in NSData I am getting nil . do { var audioData: NSData! = NSData(base64EncodedString: audioBase64String, options: NSDataBase64DecodingOptions(rawValue:0)) if audioData != nil { let sound = try AVAudioPlayer(data: audioData) sound.play() } else { print("Data Not Exist") } } catch { } On Android same base64 string is

AVAudioSequencer Causes Crash on Deinit/Segue: 'required condition is false: outputNode'

陌路散爱 提交于 2019-12-02 09:47:02
The below code causes a crash with the following errors whenever the object is deinitialized (e.g. when performing an unwind segue back to another ViewController): required condition is false: [AVAudioEngineGraph.mm:4474:GetDefaultMusicDevice: (outputNode)] Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: outputNode' The AVAudioSequencer is the root of the issue, because the error ceases if this is removed. How can this crash be avoided? class TestAudioClass { private var audioEngine: AVAudioEngine private var sampler:

AVAssetExportSession using AVAssetExportPresetPassthrough breaking output

Deadly 提交于 2019-12-02 09:12:40
I'm using AVAssetExportSession in combination with AVAssetExportPresetPassthrough to stitch multiple videos together. Everything works quite fine, except after my first sub-clip should have finished, it's picture "freezes" on the last frame but the second is not going to play. I made sure to set the layer opacity to 0.0f once each clip has finished, if I use another Preset-Type everything works... Any hints? I got in touch with Apple, they told me this is a bug, please find the the bugreport here : https://bugreport.apple.com/cgi-bin/WebObjects/RadarWeb.woa/3/wo/zpx0I9jVzf8090ZICwg1GM/5.83.28

How to color manage AVAssetWriter output

假如想象 提交于 2019-12-02 08:59:28
问题 I'm having trouble getting a rendered video's colors to match the source content's colors. I'm rendering images into a CGContext, converting the backing data into a CVPixelBuffer and appending that as a frame to an AVAssetWriterInputPixelBufferAdaptor. This causes slight color differences between the images that I'm drawing into the CGContext and the resulting video file. It seems like there are 3 things that need to be addressed: tell AVFoundation what colorspace the video is in. make the

Recording, modifying and playing audio on iOS

大兔子大兔子 提交于 2019-12-02 07:52:34
EDIT: In the end I used exactly as I explained below, AVRecorder for recording the speech and openAL for the pitch shift and playback. It worked out quite well. I got a question regarding recording, modifying and playing back audio. I asked a similar question before ( Record, modify pitch and play back audio in real time on iOS ) but I now have more information and could do with some further advice please. So firstly this is what I am trying to do (on a separate thread to the main thread): monitor the iphone mic check for sound greater than a certain volume if above threshold start recording e

Choosing the right AVCaptureSessionPreset for different devices

徘徊边缘 提交于 2019-12-02 07:42:23
问题 I am a little confused which preset I should use for different devices. Currently I am using AVCaptureSessionPresetMedium for all devices. However, I want to take advantage of different resolutions for different phones. For example the new iPhone 6s can take 4K video, and in this case I would use AVCaptureSessionPreset3840x2160 . What I am asking is an elegant way to choose the right preset for different devices. Thanks 回答1: you can use like below. [CaptureSession setSessionPreset

AVPlayerViewController doesn't play local videos

て烟熏妆下的殇ゞ 提交于 2019-12-02 07:37:26
I have added a DemoVideo.mp4 in my project and added it to copy resource file. But when i run the app it doesn't play my video. Here is my method. private func setUpAndPlayVideo() { guard let videoPath = Bundle.main.path(forResource: "DemoVideo.mp4", ofType: nil) else { return } let videoURL = NSURL(string: videoPath) let player = AVPlayer(url: videoURL! as URL) playerViewController = AVPlayerViewController() playerViewController.player = player playerViewController.view.frame = self.videoPlayerView.bounds self.videoPlayerView.addSubview(playerViewController.view) playerViewController