vuer 0.0.32rc5__py3-none-any.whl → 0.0.32rc8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of vuer might be problematic. Click here for more details.
- vuer/addons/camera_rtc.py +171 -0
- vuer/client_build/404.html +1 -1
- vuer/client_build/assets/chunks/chunk-2131c36b.js +220 -0
- vuer/client_build/assets/chunks/chunk-42690cd5.js +15 -0
- vuer/client_build/assets/chunks/chunk-8db1b443.js +1 -0
- vuer/client_build/assets/chunks/chunk-9ee83150.js +220 -0
- vuer/client_build/assets/chunks/chunk-af3ddd0a.js +6786 -0
- vuer/client_build/assets/chunks/chunk-bbf8b6fc.js +85 -0
- vuer/client_build/assets/chunks/chunk-dc0a8b73.js +4502 -0
- vuer/client_build/assets/chunks/chunk-f856f090.js +85 -0
- vuer/client_build/assets/chunks/chunk-fb530879.js +1 -0
- vuer/client_build/assets/entries/entry-client-routing.3c853994.js +2 -0
- vuer/client_build/assets/entries/entry-client-routing.fd8d1a7e.js +2 -0
- vuer/client_build/assets/entries/entry-server-routing.40c0fcc6.js +1 -0
- vuer/client_build/assets/entries/entry-server-routing.80367474.js +1 -0
- vuer/client_build/assets/entries/pages_hands.page.8bc91e13.js +1 -0
- vuer/client_build/assets/entries/pages_hands.page.f0c716fa.js +1 -0
- vuer/client_build/assets/entries/pages_index.page.041ef5af.js +97 -0
- vuer/client_build/assets/entries/pages_index.page.55624b51.js +97 -0
- vuer/client_build/assets/entries/pages_stereo_plane.page.186386ed.js +54 -0
- vuer/client_build/assets/entries/pages_stereo_plane.page.360c58a8.js +54 -0
- vuer/client_build/assets/entries/pages_video_plane.page.35550a3d.js +1 -0
- vuer/client_build/assets/entries/pages_video_plane.page.9303749c.js +1 -0
- vuer/client_build/hands/index.html +3 -3
- vuer/client_build/index.html +3 -3
- vuer/client_build/stereo_plane/index.html +3 -3
- vuer/client_build/video_plane/index.html +3 -3
- vuer/schemas/__pycache__/scene_components.cpython-38.pyc +0 -0
- vuer/schemas/scene_components.py +25 -0
- {vuer-0.0.32rc5.dist-info → vuer-0.0.32rc8.dist-info}/METADATA +1 -1
- {vuer-0.0.32rc5.dist-info → vuer-0.0.32rc8.dist-info}/RECORD +35 -13
- {vuer-0.0.32rc5.dist-info → vuer-0.0.32rc8.dist-info}/LICENSE +0 -0
- {vuer-0.0.32rc5.dist-info → vuer-0.0.32rc8.dist-info}/WHEEL +0 -0
- {vuer-0.0.32rc5.dist-info → vuer-0.0.32rc8.dist-info}/entry_points.txt +0 -0
- {vuer-0.0.32rc5.dist-info → vuer-0.0.32rc8.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import json
|
|
3
|
+
import logging
|
|
4
|
+
import os
|
|
5
|
+
import platform
|
|
6
|
+
import ssl
|
|
7
|
+
|
|
8
|
+
import aiohttp_cors
|
|
9
|
+
from aiohttp import web
|
|
10
|
+
from aiortc import RTCPeerConnection, RTCSessionDescription
|
|
11
|
+
from aiortc.contrib.media import MediaPlayer, MediaRelay
|
|
12
|
+
from aiortc.rtcrtpsender import RTCRtpSender
|
|
13
|
+
|
|
14
|
+
ROOT = os.path.dirname(__file__)
|
|
15
|
+
|
|
16
|
+
relay = None
|
|
17
|
+
webcam = None
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def create_local_tracks(play_from, decode):
|
|
21
|
+
global relay, webcam
|
|
22
|
+
|
|
23
|
+
if play_from:
|
|
24
|
+
player = MediaPlayer(play_from, decode=decode)
|
|
25
|
+
return player.audio, player.video
|
|
26
|
+
else:
|
|
27
|
+
options = {"framerate": "30", "video_size": "1280x720"}
|
|
28
|
+
if relay is None:
|
|
29
|
+
if platform.system() == "Darwin":
|
|
30
|
+
webcam = MediaPlayer(
|
|
31
|
+
"default:none", format="avfoundation", options=options
|
|
32
|
+
)
|
|
33
|
+
elif platform.system() == "Windows":
|
|
34
|
+
webcam = MediaPlayer(
|
|
35
|
+
"video=Integrated Camera", format="dshow", options=options
|
|
36
|
+
)
|
|
37
|
+
else:
|
|
38
|
+
webcam = MediaPlayer("/dev/video0", format=None, options=options)
|
|
39
|
+
relay = MediaRelay()
|
|
40
|
+
return None, relay.subscribe(webcam.video)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def force_codec(pc, sender, forced_codec):
|
|
44
|
+
kind = forced_codec.split("/")[0]
|
|
45
|
+
codecs = RTCRtpSender.getCapabilities(kind).codecs
|
|
46
|
+
transceiver = next(t for t in pc.getTransceivers() if t.sender == sender)
|
|
47
|
+
transceiver.setCodecPreferences(
|
|
48
|
+
[codec for codec in codecs if codec.mimeType == forced_codec]
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
async def index(request):
|
|
53
|
+
content = open(os.path.join(ROOT, "index.html"), "r").read()
|
|
54
|
+
return web.Response(content_type="text/html", text=content)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
async def javascript(request):
|
|
58
|
+
content = open(os.path.join(ROOT, "client.js"), "r").read()
|
|
59
|
+
return web.Response(content_type="application/javascript", text=content)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
async def offer(request):
|
|
63
|
+
params = await request.json()
|
|
64
|
+
offer = RTCSessionDescription(sdp=params["sdp"], type=params["type"])
|
|
65
|
+
|
|
66
|
+
pc = RTCPeerConnection()
|
|
67
|
+
pcs.add(pc)
|
|
68
|
+
|
|
69
|
+
@pc.on("connectionstatechange")
|
|
70
|
+
async def on_connectionstatechange():
|
|
71
|
+
print("Connection state is %s" % pc.connectionState)
|
|
72
|
+
if pc.connectionState == "failed":
|
|
73
|
+
await pc.close()
|
|
74
|
+
pcs.discard(pc)
|
|
75
|
+
|
|
76
|
+
# open media source
|
|
77
|
+
audio, video = create_local_tracks(
|
|
78
|
+
Args.play_from, decode=not Args.play_without_decoding
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
if audio:
|
|
82
|
+
audio_sender = pc.addTrack(audio)
|
|
83
|
+
if Args.audio_codec:
|
|
84
|
+
force_codec(pc, audio_sender, Args.audio_codec)
|
|
85
|
+
elif Args.play_without_decoding:
|
|
86
|
+
raise Exception("You must specify the audio codec using --audio-codec")
|
|
87
|
+
|
|
88
|
+
if video:
|
|
89
|
+
video_sender = pc.addTrack(video)
|
|
90
|
+
if Args.video_codec:
|
|
91
|
+
force_codec(pc, video_sender, Args.video_codec)
|
|
92
|
+
elif Args.play_without_decoding:
|
|
93
|
+
raise Exception("You must specify the video codec using --video-codec")
|
|
94
|
+
|
|
95
|
+
await pc.setRemoteDescription(offer)
|
|
96
|
+
|
|
97
|
+
answer = await pc.createAnswer()
|
|
98
|
+
await pc.setLocalDescription(answer)
|
|
99
|
+
|
|
100
|
+
return web.Response(
|
|
101
|
+
content_type="application/json",
|
|
102
|
+
text=json.dumps(
|
|
103
|
+
{"sdp": pc.localDescription.sdp, "type": pc.localDescription.type}
|
|
104
|
+
),
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
pcs = set()
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
async def on_shutdown(app):
|
|
112
|
+
# close peer connections
|
|
113
|
+
coros = [pc.close() for pc in pcs]
|
|
114
|
+
await asyncio.gather(*coros)
|
|
115
|
+
pcs.clear()
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
from params_proto import ParamsProto, Proto, Flag
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
class Args(ParamsProto):
|
|
122
|
+
description = "WebRTC webcam demo"
|
|
123
|
+
cert_file = Proto(help="SSL certificate file (for HTTPS)")
|
|
124
|
+
key_file = Proto(help="SSL key file (for HTTPS)")
|
|
125
|
+
|
|
126
|
+
host = Proto(default="localhost", help="Host for HTTP server (default: 0.0.0.0)")
|
|
127
|
+
port = Proto(default=8080, dtype=int, help="Port for HTTP server (default: 8080)")
|
|
128
|
+
|
|
129
|
+
play_from = Proto(help="Read the media from a file and send it.")
|
|
130
|
+
play_without_decoding = Flag(
|
|
131
|
+
"Read the media without decoding it (experimental). "
|
|
132
|
+
"For now it only works with an MPEGTS container with only H.264 video."
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
audio_codec = Proto(help="Force a specific audio codec (e.g. audio/opus)")
|
|
136
|
+
video_codec = Proto(help="Force a specific video codec (e.g. video/H264)")
|
|
137
|
+
|
|
138
|
+
verbose = Flag()
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
if __name__ == "__main__":
|
|
142
|
+
if Args.verbose:
|
|
143
|
+
logging.basicConfig(level=logging.DEBUG)
|
|
144
|
+
else:
|
|
145
|
+
logging.basicConfig(level=logging.INFO)
|
|
146
|
+
|
|
147
|
+
if Args.cert_file:
|
|
148
|
+
ssl_context = ssl.SSLContext()
|
|
149
|
+
ssl_context.load_cert_chain(Args.cert_file, Args.key_file)
|
|
150
|
+
else:
|
|
151
|
+
ssl_context = None
|
|
152
|
+
|
|
153
|
+
app = web.Application()
|
|
154
|
+
cors = aiohttp_cors.setup(
|
|
155
|
+
app,
|
|
156
|
+
defaults={
|
|
157
|
+
"*": aiohttp_cors.ResourceOptions(
|
|
158
|
+
allow_credentials=True,
|
|
159
|
+
expose_headers="*",
|
|
160
|
+
allow_headers="*",
|
|
161
|
+
allow_methods="*",
|
|
162
|
+
)
|
|
163
|
+
},
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
app.on_shutdown.append(on_shutdown)
|
|
167
|
+
cors.add(app.router.add_get("/", index))
|
|
168
|
+
cors.add(app.router.add_get("/client.js", javascript))
|
|
169
|
+
cors.add(app.router.add_post("/offer", offer))
|
|
170
|
+
|
|
171
|
+
web.run_app(app, host=Args.host, port=Args.port, ssl_context=ssl_context)
|
vuer/client_build/404.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
</head>
|
|
7
7
|
<body>
|
|
8
8
|
<div id="page-view"><h1>404 Page Not Found</h1><p>This page could not be found.</p></div>
|
|
9
|
-
<script type="module" src="/assets/entries/entry-client-routing.
|
|
9
|
+
<script type="module" src="/assets/entries/entry-client-routing.3c853994.js" defer></script>
|
|
10
10
|
<link rel="modulepreload" href="/assets/entries/renderer_error.page.3723d86c.js" as="script" type="text/javascript">
|
|
11
11
|
<link rel="modulepreload" href="/assets/chunks/chunk-3010a972.js" as="script" type="text/javascript">
|
|
12
12
|
<link rel="modulepreload" href="/assets/entries/renderer_default.page.client.9822d975.js" as="script" type="text/javascript">
|