Skip to content

Commit

Permalink
Update frontend and backend to send and receive SDP offer via Streaml…
Browse files Browse the repository at this point in the history
…it.setComponentValue
  • Loading branch information
whitphx committed Jan 24, 2021
1 parent e3f70e4 commit 7b7dd2d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 8 additions & 1 deletion tiny_streamlit_webrtc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@


def tiny_streamlit_webrtc(key=None):
component_value = _component_func(key=key, default=0)
component_value = _component_func(key=key, default=None)

if component_value:
offer_json = component_value["offerJson"]

# Debug
st.write(offer_json)

return component_value


Expand Down
6 changes: 5 additions & 1 deletion tiny_streamlit_webrtc/frontend/src/TinyWebrtc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ class TinyWebrtc extends StreamlitComponentBase<State> {
}

// Offer is created!
console.log(offer)
const offerJson = offer.toJSON()
console.log("Send offer SDP to Python process: ", offerJson)
Streamlit.setComponentValue({
offerJson,
})
})
}

Expand Down

0 comments on commit 7b7dd2d

Please sign in to comment.