tried setting up Webrtc RTP (not working)
This commit is contained in:
BIN
board-vision/frontend/.gitignore
(Stored with Git LFS)
vendored
BIN
board-vision/frontend/.gitignore
(Stored with Git LFS)
vendored
Binary file not shown.
@@ -1,14 +1,53 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
|
|
||||||
|
let peerConnection: RTCPeerConnection;
|
||||||
let videoElement: HTMLVideoElement;
|
let videoElement: HTMLVideoElement;
|
||||||
let mediaSource: MediaSource;
|
|
||||||
|
|
||||||
onMount(() => {
|
async function negotiateWebRTC(peerConn: RTCPeerConnection) {
|
||||||
mediaSource = new MediaSource();
|
peerConn.addTransceiver('video', { direction: 'recvonly' });
|
||||||
mediaSource.addSourceBuffer('video/mpeg');
|
|
||||||
videoElement.src = URL.createObjectURL(mediaSource);
|
const offer = await peerConn.createOffer();
|
||||||
})
|
await peerConn.setLocalDescription(offer);
|
||||||
|
|
||||||
|
await new Promise((resolve) => {
|
||||||
|
if(peerConn.iceGatheringState === 'complete') {
|
||||||
|
resolve(null);
|
||||||
|
} else {
|
||||||
|
peerConn.addEventListener('icegatheringstatechange', () => {
|
||||||
|
console.log(peerConn.iceGatheringState);
|
||||||
|
if(peerConn.iceGatheringState === 'complete')
|
||||||
|
resolve(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const remoteOffer = await (await fetch('/api/webrtc-offer', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify({ offer })
|
||||||
|
})).json();
|
||||||
|
|
||||||
|
await peerConn.setRemoteDescription(remoteOffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
onMount(async () => {
|
||||||
|
peerConnection = new RTCPeerConnection({
|
||||||
|
iceServers: []
|
||||||
|
});
|
||||||
|
|
||||||
|
peerConnection.addEventListener('track', (event) => {
|
||||||
|
console.log('track', event);
|
||||||
|
videoElement.srcObject = event.streams[0];
|
||||||
|
});
|
||||||
|
|
||||||
|
await negotiateWebRTC(peerConnection);
|
||||||
|
peerConnection.onconnectionstatechange = () => {
|
||||||
|
console.log("PC State:", peerConnection.connectionState);
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
|
|||||||
@@ -2,5 +2,13 @@ import { sveltekit } from '@sveltejs/kit/vite';
|
|||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [sveltekit()]
|
plugins: [sveltekit()],
|
||||||
|
server: {
|
||||||
|
proxy: {
|
||||||
|
'/api': {
|
||||||
|
target: 'http://localhost:3000',
|
||||||
|
changeOrigin: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
157
board-vision/requirements.txt
Normal file
157
board-vision/requirements.txt
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
aioice==0.9.0
|
||||||
|
aiortc==1.9.0
|
||||||
|
anyio==4.4.0
|
||||||
|
argon2-cffi==23.1.0
|
||||||
|
argon2-cffi-bindings==21.2.0
|
||||||
|
arrow==1.3.0
|
||||||
|
asgiref==3.8.1
|
||||||
|
asttokens==2.4.1
|
||||||
|
async-lru==2.0.4
|
||||||
|
attrs==23.2.0
|
||||||
|
av==12.3.0
|
||||||
|
Babel==2.15.0
|
||||||
|
beautifulsoup4==4.12.3
|
||||||
|
bleach==6.1.0
|
||||||
|
blinker==1.8.2
|
||||||
|
certifi==2024.7.4
|
||||||
|
cffi==1.16.0
|
||||||
|
charset-normalizer==3.3.2
|
||||||
|
click==8.1.7
|
||||||
|
comm==0.2.2
|
||||||
|
contourpy==1.2.1
|
||||||
|
coverage==7.6.1
|
||||||
|
cramjam==2.8.3
|
||||||
|
cryptography==43.0.3
|
||||||
|
cycler==0.12.1
|
||||||
|
debugpy==1.8.2
|
||||||
|
decorator==5.1.1
|
||||||
|
defusedxml==0.7.1
|
||||||
|
dnspython==2.7.0
|
||||||
|
executing==2.0.1
|
||||||
|
fastjsonschema==2.20.0
|
||||||
|
fastparquet==2024.5.0
|
||||||
|
filelock==3.15.4
|
||||||
|
Flask==3.0.3
|
||||||
|
fonttools==4.53.1
|
||||||
|
fqdn==1.5.1
|
||||||
|
fsspec==2024.6.1
|
||||||
|
google-crc32c==1.6.0
|
||||||
|
h11==0.14.0
|
||||||
|
httpcore==1.0.5
|
||||||
|
httpx==0.27.0
|
||||||
|
idna==3.7
|
||||||
|
ifaddr==0.2.0
|
||||||
|
imageio==2.34.2
|
||||||
|
iniconfig==2.0.0
|
||||||
|
ipykernel==6.29.5
|
||||||
|
ipython==8.26.0
|
||||||
|
isoduration==20.11.0
|
||||||
|
itsdangerous==2.2.0
|
||||||
|
janus==1.0.0
|
||||||
|
jedi==0.19.1
|
||||||
|
Jinja2==3.1.4
|
||||||
|
joblib==1.4.2
|
||||||
|
json5==0.9.25
|
||||||
|
jsonpointer==3.0.0
|
||||||
|
jsonschema==4.23.0
|
||||||
|
jsonschema-specifications==2023.12.1
|
||||||
|
jupyter-events==0.10.0
|
||||||
|
jupyter-lsp==2.2.5
|
||||||
|
jupyter_client==8.6.2
|
||||||
|
jupyter_core==5.7.2
|
||||||
|
jupyter_server==2.14.2
|
||||||
|
jupyter_server_terminals==0.5.3
|
||||||
|
jupyterlab==4.2.4
|
||||||
|
jupyterlab_pygments==0.3.0
|
||||||
|
jupyterlab_server==2.27.3
|
||||||
|
kiwisolver==1.4.5
|
||||||
|
lazy_loader==0.4
|
||||||
|
MarkupSafe==2.1.5
|
||||||
|
matplotlib==3.9.1
|
||||||
|
matplotlib-inline==0.1.7
|
||||||
|
mistune==3.0.2
|
||||||
|
mpmath==1.3.0
|
||||||
|
nbclient==0.10.0
|
||||||
|
nbconvert==7.16.4
|
||||||
|
nbformat==5.10.4
|
||||||
|
nest-asyncio==1.6.0
|
||||||
|
networkx==3.3
|
||||||
|
notebook_shim==0.2.4
|
||||||
|
numpy==2.0.1
|
||||||
|
nvidia-cublas-cu12==12.1.3.1
|
||||||
|
nvidia-cuda-cupti-cu12==12.1.105
|
||||||
|
nvidia-cuda-nvrtc-cu12==12.1.105
|
||||||
|
nvidia-cuda-runtime-cu12==12.1.105
|
||||||
|
nvidia-cudnn-cu12==9.1.0.70
|
||||||
|
nvidia-cufft-cu12==11.0.2.54
|
||||||
|
nvidia-curand-cu12==10.3.2.106
|
||||||
|
nvidia-cusolver-cu12==11.4.5.107
|
||||||
|
nvidia-cusparse-cu12==12.1.0.106
|
||||||
|
nvidia-nccl-cu12==2.20.5
|
||||||
|
nvidia-nvjitlink-cu12==12.6.20
|
||||||
|
nvidia-nvtx-cu12==12.1.105
|
||||||
|
opencv-python==4.10.0.84
|
||||||
|
overrides==7.7.0
|
||||||
|
packaging==24.1
|
||||||
|
pandas==2.2.2
|
||||||
|
pandocfilters==1.5.1
|
||||||
|
parso==0.8.4
|
||||||
|
pexpect==4.9.0
|
||||||
|
pillow==10.4.0
|
||||||
|
platformdirs==4.2.2
|
||||||
|
pluggy==1.5.0
|
||||||
|
prometheus_client==0.20.0
|
||||||
|
prompt_toolkit==3.0.47
|
||||||
|
psutil==6.0.0
|
||||||
|
ptyprocess==0.7.0
|
||||||
|
pure_eval==0.2.3
|
||||||
|
pycparser==2.22
|
||||||
|
pyee==12.0.0
|
||||||
|
Pygments==2.18.0
|
||||||
|
pylibsrtp==0.10.0
|
||||||
|
pyOpenSSL==24.2.1
|
||||||
|
pyparsing==3.1.2
|
||||||
|
pytest==8.3.3
|
||||||
|
pytest-asyncio==0.24.0
|
||||||
|
pytest-cov==5.0.0
|
||||||
|
pytest-timeout==2.3.1
|
||||||
|
python-dateutil==2.9.0.post0
|
||||||
|
python-json-logger==2.0.7
|
||||||
|
pytz==2024.1
|
||||||
|
PyYAML==6.0.1
|
||||||
|
pyzmq==26.0.3
|
||||||
|
referencing==0.35.1
|
||||||
|
requests==2.32.3
|
||||||
|
rfc3339-validator==0.1.4
|
||||||
|
rfc3986-validator==0.1.1
|
||||||
|
rpds-py==0.19.1
|
||||||
|
scikit-image==0.24.0
|
||||||
|
scikit-learn==1.5.1
|
||||||
|
scipy==1.14.0
|
||||||
|
Send2Trash==1.8.3
|
||||||
|
setuptools==72.1.0
|
||||||
|
six==1.16.0
|
||||||
|
sniffio==1.3.1
|
||||||
|
soupsieve==2.5
|
||||||
|
stack-data==0.6.3
|
||||||
|
sympy==1.13.1
|
||||||
|
terminado==0.18.1
|
||||||
|
threadpoolctl==3.5.0
|
||||||
|
tifffile==2024.7.24
|
||||||
|
tinycss2==1.3.0
|
||||||
|
torch==2.4.0
|
||||||
|
torchaudio==2.4.0
|
||||||
|
torchvision==0.19.0
|
||||||
|
tornado==6.4.1
|
||||||
|
traitlets==5.14.3
|
||||||
|
triton==3.0.0
|
||||||
|
types-python-dateutil==2.9.0.20240316
|
||||||
|
typing_extensions==4.12.2
|
||||||
|
tzdata==2024.1
|
||||||
|
uri-template==1.3.0
|
||||||
|
urllib3==2.2.2
|
||||||
|
wcwidth==0.2.13
|
||||||
|
webcolors==24.6.0
|
||||||
|
webencodings==0.5.1
|
||||||
|
websocket-client==1.8.0
|
||||||
|
Werkzeug==3.0.4
|
||||||
BIN
board-vision/src/api/streaming/sdp_negotiation.py
(Stored with Git LFS)
Normal file
BIN
board-vision/src/api/streaming/sdp_negotiation.py
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
board-vision/src/api/streaming/video_source.py
(Stored with Git LFS)
Normal file
BIN
board-vision/src/api/streaming/video_source.py
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
board-vision/src/main_streaming_test_ref.py
(Stored with Git LFS)
Normal file
BIN
board-vision/src/main_streaming_test_ref.py
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
board-vision/src/main_video_stream_test.py
(Stored with Git LFS)
Normal file
BIN
board-vision/src/main_video_stream_test.py
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
board-vision/test/vision/api/streaming/test_StreamTrackOpencv.py
(Stored with Git LFS)
Normal file
BIN
board-vision/test/vision/api/streaming/test_StreamTrackOpencv.py
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
board-vision/test/vision/api/streaming/test_async_video_source.py
(Stored with Git LFS)
Normal file
BIN
board-vision/test/vision/api/streaming/test_async_video_source.py
(Stored with Git LFS)
Normal file
Binary file not shown.
Reference in New Issue
Block a user