avfoundation

iOS AVExportSession fails with trimmed video only

荒凉一梦 提交于 2019-12-22 10:27:33
问题 i've created a method that trims and exports videos based on a given time range. It also rotates the video to landscape. For some reason though, the AVAssetExportSession fails when attempting to process a video that previously was trimmed using UIVideoEditorController. Anyone encountered this issue before? I get this error: AVAssetExportSessionStatusFailed: Error Domain=AVFoundationErrorDomain Code=-11841 "The operation couldn’t be completed. (AVFoundationErrorDomain error -11841.)" For this

How to stop/cancel playSoundFileNamed in Swift?

余生长醉 提交于 2019-12-22 10:01:55
问题 I'm trying to make a button, which is when pushed - the sound is played, and when pushed again - the sound would stop. I'm using playSoundFileNamed: runAction: withKey: and removeActionForKey , but it doesn't work. The other question I have is if there is a way not only to stop the sound, but also to pause it (so that it will start from the same part it was paused, NOT from the beginning). I've seen a similar topic at stack overflow, but yet didn't find an answer on my question yet. Thank you

Swift : take photo from AVFoundation

天涯浪子 提交于 2019-12-22 09:58:04
问题 I want to translate this func from obj c to swift, buti can't translate a part of the code. Could someone explain me how to take photo from AVFondation or help me to translate this function ? - (void) capImage { //method to capture image from AVCaptureSession video feed AVCaptureConnection *videoConnection = nil; for (AVCaptureConnection *connection in stillImageOutput.connections) { for (AVCaptureInputPort *port in [connection inputPorts]) { if ([[port mediaType] isEqual:AVMediaTypeVideo] )

AVAssetWriter goes AVAssetWriterStatusFailed after appendSampleBuffer:

隐身守侯 提交于 2019-12-22 09:03:45
问题 I am trying to perform screen-recording using AVAssetWriter, which also accepts audio input. However, I have been stuck on this error, where AVAssetWriter sometimes becomes AVAssetWriterStatusFailed after a few calls on appendSampleBuffer: (inside encodeAudioFrame: ) Failed: Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo=0x32b570 {NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x70d710 "The operation couldn’t be

record video with AVFoundation with custom dimensions? [duplicate]

社会主义新天地 提交于 2019-12-22 08:46:38
问题 This question already has answers here : How do I use AVFoundation to crop a video (2 answers) Closed 6 years ago . I am recording an MOV file using AVFoundation but im having trouble finding out how to change the dimensions of the video. I have videoGravity property of captureVideoPreviewLayer set to AVLayerVideoGravityResizeAspectFill and the UIView showing the preview layer has custom dimensions (not the same aspect ratio of the screen). Recording works fine but the dimensions of the

dyld: Library not loaded: AVFoundation.framework Reason: image not found

早过忘川 提交于 2019-12-22 08:38:35
问题 How do I fix this? dyld: Library not loaded: /System/Library/Frameworks/AVFoundation.framework/Versions/A/AVFoundation Referenced from: /Users/[...]/Library/Application Support/iPhone Simulator/User/Applications/[...]/TestGame.app/TestGame Reason: image not found 回答1: You need to add this Framework to Xcode. Right-click on "Frameworks" > Choose Add > Existing Frameworks Locate "AVFoundation" then choose Add. If you want to add it manually, choose the other button and navigate to: /Developer

Airplay: Playing a Movie from MPMoviePlayerController results in only audio being streamed to Apple tv

眉间皱痕 提交于 2019-12-22 08:35:19
问题 Setting up Airplay was easy enough. self.moviePlayer = [[[MPMoviePlayerViewController alloc] initWithContentURL:url] autorelease]; [self.moviePlayer setAllowsAirPlay:YES]; However, when I try to play a video, only the audio is streamed. The video continues to play on the iPad. Additionally, the Airplay control only shows the "Audio Only" icon in the source list. (see photo). This makes me think that iOS "thinks" that only audio is playing. I have several other apps with Airplay on my device

Open camera roll on an exact photo

女生的网名这么多〃 提交于 2019-12-22 08:22:58
问题 I'm developing a camera application where I'd like to put some functions that are already present in the stock app. My problem is replicating the little square in the bottom left corner (in portrait mode) where the micro-thumbnail of the photo that the user has just taken is shown; then, when the user tap on it, the photo app should open, on the last photo saved in the camera roll. I can load the thumbnail of the newest photo in camera roll with ALAssetsLibrary - I've access to it with

MPMediaItem not playing in AVAudioPlayer using MPMediaItemPropertyAssetURL

随声附和 提交于 2019-12-22 08:16:42
问题 I have this code, to find and play a MPMediaItem: MPMediaPropertyPredicate *predicate = [MPMediaPropertyPredicate predicateWithValue:self.persistentIDOfSongToPlay forProperty:MPMediaItemPropertyPersistentID comparisonType:MPMediaPredicateComparisonContains]; NSSet *predicateSet = [NSSet setWithObject:predicate]; MPMediaQuery *searchQuery = [[MPMediaQuery alloc] initWithFilterPredicates:predicateSet]; NSArray *queryResults = [searchQuery items]; NSLog(@"count: %i", queryResults.count);

iOS offline HLS file size

梦想的初衷 提交于 2019-12-22 08:04:03
问题 In iOS 10, Apple added offline HLS. In the documentation, they mention: Important: Downloaded HLS assets are stored on disk in a private bundle format. This bundle format may change over time, and developers should not attempt to access or store files within the bundle directly, but should instead use AVFoundation and other iOS APIs to interact with downloaded assets. It appears the access to information about these files is limited. I'm trying to find the size of the stored file. Here is