avfoundation

Can I add UIImage or CGImageRef to video?

假如想象 提交于 2020-01-06 19:58:28
问题 I want to add an image in between videos, just like smiley or clip art. Smiley and Clip art most probably has animation. I referred to Find assets in library - add to a AVMutableComposition - export = crash and also Apple's ALAssetLibrary . but could not get any ideas to complete my requirement. Is there any functionality to add UIImage s and CGImageRef s to an AVMutableComposition ? How can I add an image into a video? 回答1: it has been done with CALayer. If anyone wants to add UIImage in

No Visible interface for 'AVAudioPlayer declares the selector initWithUrl:'

安稳与你 提交于 2020-01-06 15:14:43
问题 I am trying to play a button click sound,also that i should be able to manage click sound along with volume button. What i have done is Added AVFoundationFramework to project, in .h file #import <AVFoundation/AVAudioPlayer.h> #import <AVFoundation/AVFoundation.h> in .m file under button click method NSString *soundPath = [[NSBundle mainBundle] pathForResource:@"sound1" ofType:@"mp3"]; NSURL *soundUrl = [NSURL fileURLWithPath:soundPath]; AVAudioPlayer *player = [[AVAudioPlayer alloc]

How to play multiple sound?

南楼画角 提交于 2020-01-06 07:15:07
问题 I need to play multiple sound files. I have the following code: My .h class: #import <UIKit/UIKit.h> #import <AVFoundation/AVFoundation.h> #import <AudioToolbox/AudioToolbox.h> @interface ViewController : UIViewController { AVAudioPlayer *musicPlayer; } - (IBAction)music1:(id)sender; - (IBAction)music2:(id)sender; - (IBAction)music3:(id)sender; - (IBAction)music4:(id)sender; - (IBAction)music5:(id)sender; @end My .m file #import "ViewController.h" @interface ViewController () @end

How do I implement camera changing from front to back camera

ε祈祈猫儿з 提交于 2020-01-06 06:37:33
问题 Below is the code for the camera section, I tried adding in a boolean to detect when the front camera is activated but I receive an error. import UIKit import AVFoundation class MainCameraCollectionViewCell: UICollectionViewCell { @IBOutlet weak var myView: UIView! var captureSession = AVCaptureSession() var backCamera: AVCaptureDevice? var frontCamera: AVCaptureDevice? var currentCamera: AVCaptureDevice? var photoOutPut: AVCapturePhotoOutput? var cameraPreviewLayer:

How do I implement camera changing from front to back camera

拟墨画扇 提交于 2020-01-06 06:36:27
问题 Below is the code for the camera section, I tried adding in a boolean to detect when the front camera is activated but I receive an error. import UIKit import AVFoundation class MainCameraCollectionViewCell: UICollectionViewCell { @IBOutlet weak var myView: UIView! var captureSession = AVCaptureSession() var backCamera: AVCaptureDevice? var frontCamera: AVCaptureDevice? var currentCamera: AVCaptureDevice? var photoOutPut: AVCapturePhotoOutput? var cameraPreviewLayer:

Playing custom .opus audio file in iOS

被刻印的时光 ゝ 提交于 2020-01-06 05:36:08
问题 I was able to record and play opus using AVFoundation. The problem is I got a custom opus audio file (coming from server, also processed in server) as follows: | header 1 (1 byte) | opus data 1 (1~255 bytes) | header 2 (1 byte) | opus data 2 (1~255 bytes) | ... | ... | Each header indicates size of the opus data i.e. if header 1 is 200 (Int) then opus data 1 is 200 bytes So, I am extracting opus data and appending to Data buffer as following: guard let url = Bundle.main.url(forResource: "test

slow motion video not playing in slow motion on non apple platforms

你说的曾经没有我的故事 提交于 2020-01-06 03:50:05
问题 I'm able to record slow motion videos at 120fps using AVFoundation. These videos play as expected on iphone and mac quicktime player. But other players like videojs and my own player[AVPlayer] are not able to play it in slow motion. But if I create a slow motion video using iphone native camera app, then these same players are able to play it as expected. I compared the two videos using mediainfo and two differences came up - 1. Format Profile: High@L5.1 vs High@L4.1 . I used ffpmeg to make

IOS 8 film from both back and front camera

喜欢而已 提交于 2020-01-05 22:42:54
问题 How can I record on the iOS 8 or even iOS 7 (if possible) and switch between cameras while I do so? I have seen apps doing this recording from front camera and then switching to back camera and when the film is completed you can see it entirely filmed from both cameras? I think Glide app has it and maybe Snapchat (not sure on the last one) 回答1: After long searches and struggles, here is the code... thanks for your suggestion Matic for pointing me to the right path, I have made something a

AVAudioPlayer Object Sound Not Playing - Swift

為{幸葍}努か 提交于 2020-01-05 08:11:45
问题 I have created an object class of AVAudioPlayer below in order to play a noise: class MusicAudio: NSObject, AVAudioPlayerDelegate { var bassAudio : AVAudioPlayer! = AVAudioPlayer() override init() { super.init() let bassAudioPath = NSBundle.mainBundle().pathForResource("Raw", ofType:"mp3") let fileURL = NSURL(fileURLWithPath: bassAudioPath!) bassAudio = AVAudioPlayer(contentsOfURL: fileURL, error: nil) bassAudio.currentTime = 0 bassAudio.volume = 1.0 bassAudio.delegate = self } func

AVAudioPlayer Object Sound Not Playing - Swift

给你一囗甜甜゛ 提交于 2020-01-05 08:11:09
问题 I have created an object class of AVAudioPlayer below in order to play a noise: class MusicAudio: NSObject, AVAudioPlayerDelegate { var bassAudio : AVAudioPlayer! = AVAudioPlayer() override init() { super.init() let bassAudioPath = NSBundle.mainBundle().pathForResource("Raw", ofType:"mp3") let fileURL = NSURL(fileURLWithPath: bassAudioPath!) bassAudio = AVAudioPlayer(contentsOfURL: fileURL, error: nil) bassAudio.currentTime = 0 bassAudio.volume = 1.0 bassAudio.delegate = self } func