mirror of
https://github.com/facefusion/facefusion.git
synced 2026-08-11 03:20:23 +02:00
Implement basic webrtc stream (#1054)
* 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>
This commit is contained in:
committed by
henryruhs
co-authored by
henryruhs
parent
9159f45a5f
commit
ab24cd3f2e
@@ -0,0 +1,21 @@
|
||||
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
|
||||
Reference in New Issue
Block a user