mac运行appRtc

安装privoxy:

$ brew install privoxy

/usr/local/etc/privoxy/config 下配置:

forward-socks5 /127.0.0.1:1080.

listen-address0.0.0.0:8118

forward192.168.*.*/ .

forward 10.*.*.*/.

forward127.*.*.*/ .

forward 172.*.*.*/.

forward git.meiyou.im/ .

forward ci.meiyou.im/ .

设置


sudo /usr/local/sbin/privoxy /usr/local/etc/privoxy/config

alias setss="export http_proxy=127.0.0.1:8118&&export https_proxy=127.0.0.1:8118"

alias unsetss="unset http_proxy&&unset https_proxy"


$ setss #启动

$ unsetss  #停止

配置git代理

git config --global https.proxy 'socks5://127.0.0.1:1080'

git config --global http.proxy 'socks5://127.0.0.1:1080'

取消设置git代理

git config --global --unset http.proxy

git config --global --unset https.proxy

xcode project

https://blog.piasy.com/2018/08/14/build-webrtc/

 gn gen out/Release-universal --args='target_os="ios" target_cpu="arm64" is_component_build=false is_debug=true ios_enable_code_signing=true' --ide=xcode

src/examples/BUILD.gn中,搜ios_app_bundle("AppRTCMobile"),增加:

extra_substitutions = [

        "PRODUCT_BUNDLE_IDENTIFIER=com.github.AppRTCMobile。。。",

      ]

src/sdk/build.gn中搜ios_framework_bundle_with_umbrella_header("framework_objc") ,增加

extra_substitutions = [

        "PRODUCT_BUNDLE_IDENTIFIER=org.webrtc.WebRTC。。。。。",

          ]

Edit the file src/examples/objc/AppRTCMobile/ios/Info.plistand change the valuecom.google.AppRTCMobile with your own bundle identifier.

Edit the filesrc/sdk/objc/Framework/Info.plist and change the valueorg.webrtc.WebRTCwith your own bundle identifier


Room_Server

参考https://www.jianshu.com/p/7fd28c26a2cb

在 AppRTC 目录下执行启动命令

apprtc.py 修改地址

constant.py

TURN_BASE_URL = 'http://192.168.106.67'
TURN_URL_TEMPLATE = '%s/turn?username=zl&key=123456'
ICE_SERVER_BASE_URL = 'http://192.168.106.67'
ICE_SERVER_URL_TEMPLATE = '%s/v1alpha/iceconfig?key=%s'
ICE_SERVER_API_KEY = os.environ.get('ICE_SERVER_API_KEY')

# Dictionary keys in the collider instance info constant.
WSS_INSTANCE_HOST_KEY = '192.168.106.67:8089'
WSS_INSTANCE_NAME_KEY = 'zl'
WSS_INSTANCE_ZONE_KEY = '123456'
WSS_INSTANCES = [{
    WSS_INSTANCE_HOST_KEY: '192.168.106.67:8089',
    WSS_INSTANCE_NAME_KEY: 'zl',
    WSS_INSTANCE_ZONE_KEY: '123456'
}, {
    WSS_INSTANCE_HOST_KEY: '192.168.106.67:8089',
    WSS_INSTANCE_NAME_KEY: 'zl',
    WSS_INSTANCE_ZONE_KEY: '123456'
}]

WSS_HOST_PORT_PAIRS = [ins[WSS_INSTANCE_HOST_KEY] for ins in WSS_INSTANCES]

# memcache key for the active collider host.
WSS_HOST_ACTIVE_HOST_KEY = 'wss_host_active_host'

# Dictionary keys in the collider probing result.
WSS_HOST_IS_UP_KEY = 'is_up'
WSS_HOST_STATUS_CODE_KEY = 'status_code'
WSS_HOST_ERROR_MESSAGE_KEY = 'error_message'

RESPONSE_ERROR = 'ERROR'
RESPONSE_ROOM_FULL = 'FULL'
RESPONSE_UNKNOWN_ROOM = 'UNKNOWN_ROOM'
RESPONSE_UNKNOWN_CLIENT = 'UNKNOWN_CLIENT'
RESPONSE_DUPLICATE_CLIENT = 'DUPLICATE_CLIENT'
RESPONSE_SUCCESS = 'SUCCESS'
RESPONSE_INVALID_REQUEST = 'INVALID_REQUEST'

IS_DEV_SERVER = os.environ.get('APPLICATION_ID', '').startswith('dev')

BIGQUERY_URL = 'https://www.googleapis.com/auth/bigquery'

# Dataset used in production.
BIGQUERY_DATASET_PROD = 'prod'

# Dataset used when running locally.
BIGQUERY_DATASET_LOCAL = 'dev'

# BigQuery table within the dataset.
BIGQUERY_TABLE = 'analytics'

dev_appserver.py -–host=0.0.0.0. out/app_engine

room-server=http://192.168.106.44:8080 地址写入ARDAppEngineClient.m

信令服务器

apprtc/src/collider/collidermain/main.go修改地址

go install collidermain

$GOPATH/bin/collidermain -port=8089 -tls=false

生成key:

turnadmin -a -u test -r rtc.whenchat.com -p test 

  turnadmin -k -u test -r rtc.whenchat.com -p test

 sudo openssl req -x509 -newkey  rsa:2048 -keyout /etc/turn_server_pkey.pem\

                 -out /etc/turn_server_cert.pem -days 99999 -nodes

修改turnserver.conf

listening-device=wlxe840f236118e
listening-port=3478
relay-device=wlxe840f236118e
#转发端口号范围
min-port=59000
max-port=65000
#Verbose
fingerprint
#webrtc需要使用此选项
lt-cred-mech
use-auth-secret
static-auth-secret=4080218913
#之前turnadmin中-r参数的值,此处要对应
realm=qiniu
#stale-nonce=600
#max-allocate-lifetime=3000
#可以添加用户名和密码
user=test:test
#测试期间可以使用example/etc中的pem,自己计算的话需要用到openssl,方法为:
#sudo openssl req -x509 -newkey rsa:2048 -keyout /etc/turn_server_pkey.pem -out /etc/turn_server_cert.pem -days 99999 -nodes

#填写pem目录即可,如
#cert=~/OpenSource/coturn/example/etc/turn_server_cert.pem
#pkey==$HOME/OpenSource/coturn/example/etc/turn_server_pkey.pem
# Certificate file.
# Use an absolute path or path relative to the
# configuration file.
#
cert=/Users/zl/Documents/webrtc_server/turnserver-4.5.0.8/bin/turn_server_cert.pem

# Private key file.
# Use an absolute path or path relative to the
# configuration file.
# Use PEM file format.
#
pkey=/Users/zl/Documents/webrtc_server/turnserver-4.5.0.8/bin/turn_server_pkey.pem

no-loopback-peers
no-multicast-peers
mobility
no-cli
#各项参数含义,可以看turnserver.conf中的说明。


turn server

参考

https://www.jianshu.com/p/8bb8c548d54a

https://my.oschina.net/andywang1988/blog/848645

turnserver start

你可能感兴趣的:(mac运行appRtc)