-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy patheg_videocall_out.py
More file actions
65 lines (50 loc) · 1.71 KB
/
eg_videocall_out.py
File metadata and controls
65 lines (50 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import asyncio
import logging
from janus_client import JanusSession, JanusVideoCallPlugin
from aiortc.contrib.media import MediaPlayer, MediaRecorder
format = "%(asctime)s: %(message)s"
logging.basicConfig(format=format, level=logging.INFO, datefmt="%H:%M:%S")
logger = logging.getLogger()
async def main():
# Create session
session = JanusSession(
base_url="wss://janusmy.josephgetmyip.com/janusbasews/janus",
)
# Create plugin
plugin_handle = JanusVideoCallPlugin()
# Attach to Janus session
await plugin_handle.attach(session=session)
logger.info("plugin created")
username = "testusernamein"
username_out = "testusernameout"
# player = MediaPlayer("./Into.the.Wild.2007.mp4")
# player = MediaPlayer("http://download.tsi.telecom-paristech.fr/gpac/dataset/dash/uhd/mux_sources/hevcds_720p30_2M.mp4")
player = MediaPlayer(
"desktop",
format="gdigrab",
options={
"video_size": "640x480",
"framerate": "30",
"offset_x": "20",
"offset_y": "30",
},
)
recorder = MediaRecorder("./videocall_record_out.mp4")
result = await plugin_handle.register(username=username_out)
logger.info(result)
result = await plugin_handle.call(
username=username, player=player, recorder=recorder
)
logger.info(result)
await asyncio.sleep(30)
result = await plugin_handle.hangup()
logger.info(result)
# Destroy plugin
await plugin_handle.destroy()
# Destroy session
await session.destroy()
if __name__ == "__main__":
try:
asyncio.run(main())
except KeyboardInterrupt:
pass