Skip to content

Commit

Permalink
Added ICE server configuration options
Browse files Browse the repository at this point in the history
Relevant to #4, so that TURN servers can be set. Also fixed the docs, which were broken by new sphinx (I think).
  • Loading branch information
dkumor committed Aug 22, 2019
1 parent 4c4a9fc commit 92f6e82
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"sphinx.ext.intersphinx",
"sphinx.ext.viewcode",
"sphinx.ext.githubpages",
"sphinxcontrib.asyncio",
#"sphinxcontrib.asyncio",
"sphinx_js",
"sphinx.ext.napoleon",
"sphinx_autodoc_typehints",
Expand Down
1 change: 0 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
sphinx-js
sphinxcontrib-asyncio
sphinx-autodoc-typehints

numpy
Expand Down
2 changes: 1 addition & 1 deletion js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rtcbot",
"version": "0.0.7",
"version": "0.0.8",
"description": "",
"main": "dist/rtcbot.cjs.js",
"module": "dist/rtcbot.esm.js",
Expand Down
6 changes: 3 additions & 3 deletions js/src/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ class RTCConnection {
* For detailed documentation, see the RTCConnection docs for Python.
*
* @param {*} defaultOrdered
* @param {*} options
* @param {*} rtcConfiguration is the configuration given to the RTC connection
*/
constructor(
defaultOrdered = true,
options = {
rtcConfiguration = {
iceServers: [{ urls: ["stun:stun.l.google.com:19302"] }]
}
) {
this._dataChannels = {};

this._msgcallback = msg => console.log(msg);

this._rtc = new _RTCPeerConnection(options);
this._rtc = new _RTCPeerConnection(rtcConfiguration);
this._rtc.ondatachannel = this._onDataChannel.bind(this);
this._rtc.ontrack = this._onTrack.bind(this);

Expand Down
5 changes: 2 additions & 3 deletions rtcbot/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def subscribe(self, subscription=None):
class RTCConnection(SubscriptionProducerConsumer):
_log = logging.getLogger("rtcbot.RTCConnection")

def __init__(self, defaultChannelOrdered=True, loop=None):
def __init__(self, defaultChannelOrdered=True, loop=None, rtcConfiguration=None):
super().__init__(
directPutSubscriptionType=asyncio.Queue,
defaultSubscriptionType=asyncio.Queue,
Expand All @@ -336,8 +336,7 @@ def __init__(self, defaultChannelOrdered=True, loop=None):
self._dataChannelSubscriber = SubscriptionProducer(
logger=self._log.getChild("dataChannelSubscriber")
)

self._rtc = RTCPeerConnection()
self._rtc = RTCPeerConnection(configuration=rtcConfiguration)
self._rtc.on("datachannel", self._onDatachannel)
# self._rtc.on("iceconnectionstatechange", self._onIceConnectionStateChange)
self._rtc.on("track", self._onTrack)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# This call to setup() does all the work
setuptools.setup(
name="rtcbot",
version="0.0.7",
version="0.0.8",
description="An asyncio-focused library for webrtc robot control",
long_description=README,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 92f6e82

Please sign in to comment.