Basic-Video-Broadcasting icon indicating copy to clipboard operation
Basic-Video-Broadcasting copied to clipboard

iOS: Unable to start video broadcast

Open sashabaranov opened this issue 4 years ago • 2 comments

Hey guys,

I was following this tutorial and could not start a local video preview / broadcast.

The problem spot seem to be in:

let vidCode = agoraKit.enableVideo()
print("Video enable code: \(vidCode)")

It returns code -7 which as docs suggest indicates an error.

I've also tried to build your example from here and it also does not start. Not even a request for my camera. See screenshot attached.

photo_2021-02-18 18 39 00

sashabaranov avatar Feb 18 '21 15:02 sashabaranov

@sashabaranov -7 means sdk is not yet initialized. have you put in the appid and token field as instructed in the readme?

plutoless avatar Feb 28 '21 12:02 plutoless

An error code can be a negative number. In such a case, it should be read as if it were positive. For example, if the SDK returns error code -2, you should refer to 2 in the error code table.

7 A method is called before the initialization of RtcEngine. Ensure that the RtcEngine instance is created and initialized before calling the method.

https://docs.agora.io/en/Interactive%20Broadcast/error_rtc?platform=iOS#warning-codes


I was using .xcframeworks and what was missing was the Agoraffmpeg.xcframework.

Interestingly, when using .xcframework the app would run just fine but fail “silently” with just this misleading -7 error code, while with .framework the app would crash on launch with a helpful message:

dyld: Library not loaded: @rpath/Agoraffmpeg.framework/Agoraffmpeg
  Referenced from: /private/var/containers/Bundle/Application/D3D2D968-ED95-4557-ABA5-F9D418B8131A/MyApp.app/Frameworks/AgoraRtcKit.framework/AgoraRtcKit
  Reason: image not found

Not sure if there’s something Agora can do on their side about this, but would be nice to have some informative troubleshooting message when there’s a missing .xcframework.

hvsw avatar Aug 03 '21 21:08 hvsw