anyRTC-RTMP-OpenSource
anyRTC-RTMP-OpenSource copied to clipboard
无法连接到rtmp服务器,一直是连接中状态
平台: iOS 系统版本: 12.5.5 iPhone 6
无法连接到本地rtmp服务器 ,rtmp服务连接状态一直是连接中。使用另外一个推流工具LFLiveKit https://github.com/LaiFengiOS/LFLiveKit 可以正常推流摄像头视频到本地服务。
如下图
经过调试定位到, rtmp服务连接失败,一连接就返回 -1 错误。 但是swfit代码RTMP状态并没有更新还是一直连接中
以下是log输出
objc[4224]: Class RTCWrappedNativeVideoDecoder is implemented in both /System/Library/PrivateFrameworks/WebCore.framework/Frameworks/libwebrtc.dylib (0x2169e7428) and /private/var/containers/Bundle/Application/8758DCA0-3C30-4B95-B856-E0FDE20A5019/AR-Live-Tutorial.app/Frameworks/ARLiveKit.framework/Frameworks/WebRTC.framework/WebRTC (0x101970f30). One of the two will be used. Which one is undefined. objc[4224]: Class RTCWrappedNativeVideoEncoder is implemented in both /System/Library/PrivateFrameworks/WebCore.framework/Frameworks/libwebrtc.dylib (0x2169e7478) and /private/var/containers/Bundle/Application/8758DCA0-3C30-4B95-B856-E0FDE20A5019/AR-Live-Tutorial.app/Frameworks/ARLiveKit.framework/Frameworks/WebRTC.framework/WebRTC (0x101970f80). One of the two will be used. Which one is undefined. objc[4224]: Class RTCCVPixelBuffer is implemented in both /System/Library/PrivateFrameworks/WebCore.framework/Frameworks/libwebrtc.dylib (0x21888e018) and /private/var/containers/Bundle/Application/8758DCA0-3C30-4B95-B856-E0FDE20A5019/AR-Live-Tutorial.app/Frameworks/ARLiveKit.framework/Frameworks/WebRTC.framework/WebRTC (0x1019710c0). One of the two will be used. Which one is undefined. objc[4224]: Class RTCVideoDecoderVP8 is implemented in both /System/Library/PrivateFrameworks/WebCore.framework/Frameworks/libwebrtc.dylib (0x2169e7180) and /private/var/containers/Bundle/Application/8758DCA0-3C30-4B95-B856-E0FDE20A5019/AR-Live-Tutorial.app/Frameworks/ARLiveKit.framework/Frameworks/WebRTC.framework/WebRTC (0x101971138). One of the two will be used. Which one is undefined. 2022-04-12 18:10:41.639312+0800 AR-Live-Tutorial[4224:600667] [DYMTLInitPlatform] platform initialization successful 2022-04-12 18:10:47.547463+0800 AR-Live-Tutorial[4224:600559] <CATransformLayer: 0x281af54c0> - changing property masksToBounds in transform-only layer, will have no effect 2022-04-12 18:10:47.548033+0800 AR-Live-Tutorial[4224:600559] <CATransformLayer: 0x281af54c0> - changing property cornerRadius in transform-only layer, will have no effect 2022-04-12 18:10:47.579343+0800 AR-Live-Tutorial[4224:600559] Metal GPU Frame Capture Enabled 2022-04-12 18:10:47.584783+0800 AR-Live-Tutorial[4224:600559] Metal API Validation Enabled 2022-04-12 18:12:09.015178+0800 AR-Live-Tutorial[4224:600559] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles 2022-04-12 18:12:09.019510+0800 AR-Live-Tutorial[4224:600559] [MC] Reading from public effective user settings. 18:12:09 [💙] onPushStatusUpdate status = 1 18:12:09 [💙] onCaptureFirstAudioFrame 18:12:10 [💙] onCaptureFirstVideoFrame
已解决, 这是iOS 国行手机的问题。 因为我的rtmp服务是本地的局域网IP,下面的代码直接走ip连接不会触发请求网络权限的弹窗,我改成了一个域名的remp地址就触发了网络权限的弹窗。 后面我删除手机上的demo app重新跑demo工程,然后改回本地局域网的IP,不会触发请求网络权限的弹窗。默认就有了网络权限的弹窗。
虽然这跟iOS的国行版系统有关系,但是我们的sdk是不是在初始化的时候就去请求一个网络链接主动触发这个网络权限弹窗就没有这个问题了。