Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 07-23-2011, 04:15 PM   #1 (permalink)
Registered Member
 
Join Date: Apr 2009
Posts: 55
listingboat is on a distinguished road
Default AVAssetWriter / AVAudioPlayer Conflict?

Weeks ago, I posted this thread regarding problems I was having with AVAssetWriter: http://www.iphonedevsdk.com/forum/ip...iter-woes.html

Further research seems to lead to a conflict using AVAssetWriter while playing audio with AVAudioPlayer or, really, any audio system. I tried with OpenAL as well.

Here's the background:

- Using AVAssetWriter to write frames to a video from an image or set of images works fine UNTIL [AVAudioPlayer play] is called.

- This only happens on the device, not the sim.

- The error occurs when attempting to create a pixel buffer from CVPixelBufferPoolCreatePixelBuffer.

- Once the audio starts playing, the AVAssetWriterInputPixelBufferAdaptor.pixelBufferPo ol which existed before suddely becomes nil.

You can download the representative project here: TestAVMethods.zip

Comment out AVAudioPlayer play and it will work on the device.

Any clues are appreciated.
listingboat is offline   Reply With Quote
Old 07-24-2011, 11:39 AM   #2 (permalink)
Registered Member
 
Join Date: Apr 2009
Posts: 55
listingboat is on a distinguished road
Default Solved!

I've found the solution to this issue.

If you want to have AVAudioPlayer and AVAssetWriter behave correctly together, you must have and audio session category that is 'mixable'.

You can use a category that is mixable like AVAudioSessionCategoryAmbient.

However, I needed to use AVAudioSessionCategoryPlayAndRecord.

You can set any category to be mixable by implementing this:

Code:
    OSStatus propertySetError = 0;

    UInt32 allowMixing = true;

    propertySetError = AudioSessionSetProperty (
                           kAudioSessionProperty_OverrideCategoryMixWithOthers,  // 1
                           sizeof (allowMixing),                                 // 2
                           &allowMixing                                          // 3
                       );
listingboat is offline   Reply With Quote
Reply

Bookmarks

Tags
audio, avassetwriter, avaudioplayer, ios, video

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 406
17 members and 389 guests
7twenty7, blasterbr, buggen, chiataytuday, Clouds, dre, fiftysixty, HemiMG, jeroenkeij, jimmyon122, jonathandeknudt, LEARN2MAKE, n00b, nyoe, pungs, tymex, UMAD
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,668
Threads: 94,121
Posts: 402,901
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jonathandeknudt
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:58 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0