mirror of
https://github.com/facefusion/facefusion.git
synced 2026-04-23 01:46:09 +02:00
ab24cd3f2e
* implement basic webrtc_stream * add aiortc to requirements.txt * update aiortc version * rename variables with rtc_ prefix * changes * changes * change helper to assert_helper and stream_helper * rename variables with rtc_ prefix * add error handling * return whole connection * remove monkey patch and some cleaning * cleanup * tiny adjustments * tiny adjustments * proper typing and naming for rtc offer set * - remove async from on_video_track method - rename source -> target - add audio * audio always before video --------- Co-authored-by: henryruhs <info@henryruhs.com>
22 lines
515 B
Python
22 lines
515 B
Python
from aiortc import RTCPeerConnection, VideoStreamTrack
|
|
|
|
from facefusion.types import RtcOfferSet
|
|
|
|
|
|
async def create_rtc_offer() -> RtcOfferSet:
|
|
rtc_connection = RTCPeerConnection()
|
|
rtc_connection.addTrack(VideoStreamTrack())
|
|
rtc_offer = await rtc_connection.createOffer()
|
|
|
|
await rtc_connection.setLocalDescription(rtc_offer)
|
|
|
|
rtc_offer_set : RtcOfferSet =\
|
|
{
|
|
'sdp': rtc_connection.localDescription.sdp,
|
|
'type': rtc_connection.localDescription.type
|
|
}
|
|
|
|
await rtc_connection.close()
|
|
|
|
return rtc_offer_set
|