Closed rishopbabu closed 10 months ago
This happens when the sample rate of the audio session is 0 (which means we wouldn't be able to record). I have 2 requests
Hi @bclymer, We can't able to reproduce this in the repo sample application. But in some random scenarios this error keeps on pop ups "Error title: Error (Code: 10102) Error Message:Source: <IVSMicrophoneSource: 0x1476c3a30>\nError: The attached device could not be used as an input source.".
Here are some sample codes:
private weak var broadcastSession: IVSBroadcastSession? private var mic: IVSMicrophone?
while initialising the controller: let devices = IVSDeviceDiscovery().listLocalDevices() let micDevice = devices.compactMap({ $0 as? IVSMicrophone }).first micDevice?.setGain(1) self.mic = micDevice
Mute button action: self.mic?.setGain(1) -> to unmute self.mic?.setGain(0) -> to mute
If it can not reproduce in our sample application it sounds like it might be something to do with your integration. Are you doing anything with AVAudioSession
in your application that might conflict with the SDK?
Could you also show how you attach the device to the IVSBroadcastSession
? At the moment it looks like you acquire the mic but I don't see it ever getting started or attached to anything.
And finally, what triggers the error? Does it happen randomly in the middle of a broadcast? Does it happen when going into the background? Any information helps.
This error happens, when I start to broadcast, if my previous broadcast is not ended properly(like app goes for background, or Any calls) at that time only I get this error. Not doing anything with AVAudioSession.
initialisation: private var broadcastSession: IVSBroadcastSession?
```
private func startBroadcastSession() {
do {
// Create the session with a preset config and camera/microphone combination.
IVSBroadcastSession.applicationAudioSessionStrategy = .playAndRecord
let broadcastSession = try IVSBroadcastSession(configuration: IVSPresets.configurations().standardPortrait(),
descriptors: IVSPresets.devices().frontCamera(),
delegate: self)
broadcastSession.awaitDeviceChanges { [] in
let devices = broadcastSession.listAttachedDevices()
_ = devices
.filter { $0.descriptor().type == .camera }
.compactMap { $0 as? IVSImageDevice }
}
self.broadcastSession = broadcastSession
} catch {
FTVMixPanelAnalytics(action: .talktohostLive, state: .info, data: MixPanelData(message: "Failed - Start Broadcast Session"))
displayErrorAlert(error, "setting up session")
}
if ((viewModel?.setBroadcastAuth(endpoint: url, streamKey: socket_keys.stream_key)) != nil) {
FTVMixPanelAnalytics(action: .talktohostLive, state: .info, data: MixPanelData(message: "URL Broadcast - \(url)"))
viewModel?.toggleBroadcasting()
}
viewModel?.joinStage(token: self.token ?? "")
self.startLiveStream()
}
It seems you have omitted some code again, no where does it show how you attach your microphone to the IVSBroadcastSession
or the Stage.
One thing I noticed, it is important to nil
out your resources (IVSBroadcastSession
and Stage
) before creating new ones. But even better is to reuse the existing objects instead of creating new ones at all.
hi @bclymer, IVSBroadcastSession and Stage are set to nil when closing the live. In our application we go live for few minutes and some song will play after that again we go live. When ever we close live IVSBroadcastSession and Stage are set to nil.
And one more issue we found today: Error title: Error (Code: 561145187) Error Message:Source: <IVSMicrophoneSource: 0x10c0616d0>\nError: The operation couldn’t be completed. (com.apple.coreaudio.avfaudio error 561145187.)
Is there any option to get the log level(logs) So it will be very useful. I appreciate your support. Thanks in advance.
IVSSession
exposes logLevel
which you can set to .debug
. Is your application making changes to AVAudioSession
? Our SDK expects to own the AVAudioSession
completely because there is a lot it needs to manage in order to coordinate an IVSStage
and IVSBroadcastSession
simultaneously. That could be causing issues if your application is changing the active state, category, or mode.
Hi @bclymer, thanks for your support I really appreciate it.
Is your application making changes to AVAudioSession? - NO
private var broadcastSession: IVSBroadcastSession?
broadcastSession?.logLevel = .debug
is this the way to initialise the debug log level? Can you please guide me with this?
how to save these log to a file? is there any log path file can be found in sdk?
@rishopbabu make sure you initialize your IVSBroadcastSession
before setting logLevel
, otherwise yes that is the correct approach.
The logs are printed to the Xcode console like other logs, there is not currently any way to intercept or retrieve them. They are meant for developers debugging locally.
@bclymer, thanks a lot.
HI @bclymer, This issue again arises after a long time. We still use the IVS Broadcast sdk version 1.9.1. This thread is again opened in this https://github.com/aws-samples/amazon-ivs-broadcast-ios-sample/issues/64
Since you opened a new issue, I'll respond there.
Hi Team, I'm getting an error like "Error title: Error (Code: 10102) Error Message:Source: <IVSMicrophoneSource: 0x1476c3a30>\nError: The attached device could not be used as an input source." this while broadcasting. Even though there is no apps in the background. Help me with this. Thanks in advance.