I am developing an application that has audio streaming wich should also stream when the iPhone is in background. Info.plist is prepared and session mode set to AUDIO_SESSION_MODE_PLAYBACK audio plays perfectly on background. Problem comes when I have a videoplayer inside the app too, this one is not played in fullscreen and the controls style is VIDEO_CONTROL_EMBEDDED.
Video player and audio player are on different views. These are the steps followed to get the error described below:
1) Go to video view and play video
2) Close video view (stopping video + release video + set video to null)
3) Go to audio player view
4) play audio
This is the error log:
<Error>: 17:57:55.256 <AudioQueueServer> AudioQueueObject::IONodeConnection::_AcquireHardwareCodec: failed ('hwiu') <Warning>: Audio queue start failed. err: hwiu 1752656245Which ends up showing an Alert with this message:
File error:
Unable to configure network read stream.
As far as I could read in documentation, google, etc. AUDIO_SESSION_MODE_PLAYBACK uses hardware (hwiu --> hardware in use) and it can only be used by one resource at the time. Therefor it seems that video player doesn't release the audio channel and that is why the audio player can not use it.
The weird thing is when I use the videoplayer in fullscreen mode, so that the user has to click the "done" button, then there is no problem. So there needs to be something happening differently on the done click then stopping, releasing, etc. Unfortunately fullscreen is not an option for me..
Has anybody had this issue before? Any ideas on how I could solve this? Is there a way I can access the audio in the video to release it?
Thank you!!