avfoundation

Knowing when AVPlayer object is ready to play

假装没事ソ 提交于 2019-12-17 07:02:39
问题 I'm trying to play an MP3 file that is passed to an UIView from a previous UIView (stored in a NSURL *fileURL variable). I'm initializing an AVPlayer with: player = [AVPlayer playerWithURL:fileURL]; NSLog(@"Player created:%d",player.status); The NSLog prints Player created:0, which i figured means it is not ready to play yet. When i click the play UIButton , the code i run is: -(IBAction)playButtonClicked { NSLog(@"Clicked Play. MP3:%@",[fileURL absoluteString]); if(([player status] ==

Can use AVCaptureVideoDataOutput and AVCaptureMovieFileOutput at the same time?

断了今生、忘了曾经 提交于 2019-12-17 03:46:31
问题 I want to record video and grab frames at the same time with my code. I am using AVCaptureVideoDataOutput for grab frames and AVCaptureMovieFileOutput for video recording. But can't work and get the error code -12780 while working at the same time but individual. I searched this problem but get no answer. Did anyone have the same experience or explain? It's really bother me for a while time. thanks. 回答1: I can't answer the specific question put, but I've been successfully recording video and

How can I reduce the file size of a video created with UIImagePickerController?

不羁的心 提交于 2019-12-17 03:22:17
问题 I have an app that allows a user to record a video with UIImagePickerController and then upload it to YouTube. The problem is that the video file that UIImagePickerController creates is HUGE, even when the video is only 5 seconds long. For example, a 5 second long video is 16-20 megabytes. I want to keep the video in 540 or 720 quality, but I want to reduce the file size. I've been experimenting with AVFoundation and AVAssetExportSession to try to get a smaller file size. I've tried the

How can I reduce the file size of a video created with UIImagePickerController?

独自空忆成欢 提交于 2019-12-17 03:22:11
问题 I have an app that allows a user to record a video with UIImagePickerController and then upload it to YouTube. The problem is that the video file that UIImagePickerController creates is HUGE, even when the video is only 5 seconds long. For example, a 5 second long video is 16-20 megabytes. I want to keep the video in 540 or 720 quality, but I want to reduce the file size. I've been experimenting with AVFoundation and AVAssetExportSession to try to get a smaller file size. I've tried the

CMVideoFormatDescriptionGetCleanAperture() swift error

我们两清 提交于 2019-12-14 04:20:07
问题 I can't get the CMVideoFormatDescriptionGetCleanAperture() function to work. Using var videoDescriptionRef = port.formatDescription as CMVideoFormatDescriptionRef var cleanAperture = CMVideoFormatDescriptionGetCleanAperture(videoDescriptionRef, true) or var cleanAperture = CMVideoFormatDescriptionGetCleanAperture(port.formatDescription, true) gives me the following errors, respectively: Cannot convert expression's type 'CMVideoFormatDescriptionRef' to type 'CMVideoFormatDescriptionRef' And

I have video URL and want to delete it from the iPhone using this URl

丶灬走出姿态 提交于 2019-12-14 04:11:47
问题 I have created a app that stores video, now I want to remove that video when a user clicks a remove button. I am using AVFoundation for record video. My app camera gives me an output URL like this: file://localhost/private/var/mobile/Applications/4B2E02E5-3EE2-493E-8ECF-4B1DA29B9387/tmp/output.mov I have tried this but it did not work: - (void) removeFile:(NSURL *)fileURL { NSString *filePath = [fileURL path]; NSFileManager *fileManager = [NSFileManager defaultManager]; if ([fileManager

Why can't I extract data from media file using AVURLAsset in a Playground?

北战南征 提交于 2019-12-14 03:50:00
问题 In my Playground: import Cocoa import Foundation import AVFoundation var path2 = "/Users/me/Movies/bukesiyi.mp4" var video2 = NSURL(fileURLWithPath: path2, isDirectory: false) // it shows: file:///Users/me/Movies/bukesiyi.mp4 video2.checkResourceIsReachableAndReturnError(nil) // it's true var asset = AVURLAsset(URL: video2) // it shows: <AVURLAsset: 0x7fc0a9f13500, URL = file:///Users/me/Movies/bukesiyi.mp4> asset.tracksWithMediaType(AVMediaTypeVideo) // it's [] asset.readable // it's false

Caching behavior of AVURLAsset

久未见 提交于 2019-12-14 03:14:31
问题 I am using AVURLAsset with various AV/MP player classes and it seems like it is ignoring my server's caching headers. I am working with small, progressively downloaded videos (not HLS). Is there a way to ensure that videos are cached? Is there a way to pre-cache videos so they play right away? I have experimented with simply changing parameters in NSURLCache, but I haven't had any luck so far. I also can't find any direct way to manipulate how URL fetches are cached by AVURLAsset. I do not

Playing Sound On Button (AV Audio Player) returning nil string parameter

﹥>﹥吖頭↗ 提交于 2019-12-14 02:43:13
问题 I am attempting to play a sound on button press. Previously, I used Audiotoolbox which worked just fine with the same file type. However, i need to change to using AvAudioPlayer becuase it doesn't use the ringer volume. So last week I developed an understanding of using the audio player to play a sound on click. I had it working a treat on my over app using the exact same code. However, this app despite trying countless time will not work with AVFoundation/AudioPlayer. I have tried adding new

iOS - iPhone sound level low after recording sound using AVFoundation

蹲街弑〆低调 提交于 2019-12-13 19:21:34
问题 I have an app that I'm working on that one of its functions is to record a sound through the iPhone microphone and be able to play it back to me. Problem: After I record lets say, me talking for example, the playback level is extremely low. Now I did switch from AudioToolbox to AVFoundation and this happened after the switch. Do I need to code in a volume parameter for AVFoundation ? I'm not seeing anything in the documentation . I appreciate any help. 回答1: I have solved this problem. In the