avfoundation

Photos framework: Connection to assetsd was interrupted or assetsd died

不打扰是莪最后的温柔 提交于 2019-12-12 07:53:53
问题 I am getting this error when I am trying to play multiple videos using this swift library (https://github.com/piemonte/player). Not sure if it's related to that player, or to the Photos framework or what though. What happens is, I have a view that will display either a photo or a video. Everything works fine a few times until a few videos have played and then this message will pop up, followed by all the videos not being able to play and in their place you just see a black screen, and then I

How to build AVDepthData manually

烂漫一生 提交于 2019-12-12 07:27:08
问题 I want to build my own depth map and save image like portrait photo with depth info. So first of all I need generate AVDepthData. After dig how it builded, I try to reproduce it: func buildDepth() { // ... let info: [AnyHashable: Any] = [kCGImagePropertyPixelFormat: kCVPixelFormatType_DisparityFloat32, kCGImagePropertyWidth: width, kCGImagePropertyHeight: height, kCGImagePropertyBytesPerRow: bytesPerRow] let metadata = generateMetadata(photo: photo) let dic: [AnyHashable: Any] =

Video orientation after audio and video merge

烈酒焚心 提交于 2019-12-12 04:59:25
问题 I was trying to merge one audio and video, but when I save video to my library it's save. I was following some tutorial for this, but didn't find any suitable answer. but proble is video in not portrait mode. So how can i get video with portrait in my library here what i try func mergeFilesWithUrl(videoUrl:NSURL, audioUrl:NSURL) { let mixComposition : AVMutableComposition = AVMutableComposition() var mutableCompositionVideoTrack : [AVMutableCompositionTrack] = [] var

Get the last saved Photo in photo album

落花浮王杯 提交于 2019-12-12 04:47:48
问题 I use AVFoundation framework for taking photo and save it to photoAlbum: - (void)captureStillImage { AVCaptureConnection *videoConnection = nil; for (AVCaptureConnection *connection in [[self stillImageOutput] connections]) { for (AVCaptureInputPort *port in [connection inputPorts]) { if ([[port mediaType] isEqual:AVMediaTypeVideo]) { videoConnection = connection; break; } } if (videoConnection) { break; } }if ([videoConnection isVideoOrientationSupported]) [videoConnection

AVMutableVideoComposition request sourceImage is sometimes empty

霸气de小男生 提交于 2019-12-12 04:19:28
问题 This is sort of an extension of this question of mine, but I think it is different enough to merit its own question: I am filtering videos of various sizes, scales, etc. by feeding them into an AVMutableVideoComposition . This is the code that I currently have: private func filterVideo(with filter: Filter?) { if let player = playerLayer?.player, let playerItem = player.currentItem { let composition = AVMutableComposition() let videoAssetTrack = playerItem.asset.tracks(withMediaType: .video)

NSOSStatusErrorDomain Code=-54 for AVAudioPlayer

断了今生、忘了曾经 提交于 2019-12-12 04:16:58
问题 AVAudioPlayer has been giving me the following error on some local MP3 files: Error Domain=NSOSStatusErrorDomain Code=-54 "(null)" I'm downloading a zip file to the Documents directory, then unzipping using a library called SSZipArchive. In the Documents directory, a folder is created to contain the unzipped files. I was able to play entire albums without any issues. Everything was going fine until I start downloading certain files. I've looked for similar questions (osx), possibly stating

Does AVPlayer support DVB Bitmap subtitles?

て烟熏妆下的殇ゞ 提交于 2019-12-12 04:05:33
问题 I currently work at a cable TV provider in Brazil which requires DVB Bitmap for some of its assets. I've searched quite alot on Google and Stackoverflow and haven't found any denial or confirmation about this. Does AVPlayer support DVB Bitmap subtitles? If not, which subtitle types does it support? 来源: https://stackoverflow.com/questions/46077711/does-avplayer-support-dvb-bitmap-subtitles

How to convert CMSampleBuffer to std::vector<char>?

半腔热情 提交于 2019-12-12 03:33:41
问题 I have image stream from my AVCaptureVideoDataOutputSampleBufferDelegate method: - (void)captureOutput:(AVCaptureOutput )captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection )connection; 
Then I want to take sampleBuffer and provide it for C++ openalrp library to recognize which takes image bytes or raw pixel data. What function should I use and how to convert sampleBuffer to suitable input type, std::vector<char> or unsigned char* pixelData

Sound causing game to lag in swift sprite kit game?

痞子三分冷 提交于 2019-12-12 03:09:13
问题 New code class SceneTwo: SKScene, SKPhysicsContactDelegate { let flap = SKAction.playSoundFileNamed("flap.caf", waitForCompletion: false) let whack = SKAction.playSoundFileNamed("whack.caf", waitForCompletion: false) let tap = SKAction.playSoundFileNamed("tap.caf", waitForCompletion: false) Then I simply have put run(tap) run(flap) etc where necessary.. Hi just wondering if I am using the correct coding to play sounds in my game. For some context my game is similar to Flappy bird. One sound

How add AVCaptureDeviceInput to AVCaptureSession from bluetooth device?

自古美人都是妖i 提交于 2019-12-12 01:47:02
问题 I need to record a video with AVCaptureSession in an iOS app. When I add AVCaptureDeviceInput to my current AVCaptureSession , it always adds the iphone microphone. I have the bluetooth microphone connected to the device. But it is not recording from the external microphone. I'm doing this: - (BOOL)prepareAudioSession { // deactivate session BOOL success = [[AVAudioSession sharedInstance] setActive:NO error: nil]; if (!success) { NSLog(@"deactivationError"); } // Bluetooth support enable