-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
31 lines (23 loc) · 858 Bytes
/
server.py
File metadata and controls
31 lines (23 loc) · 858 Bytes
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
#!/usr/bin/env python3
# coding:utf-8
import sys
import threading
import html_server
from camera_streaming import CameraStreaming
from streaming_server import StreamingServer
if len(sys.argv) < 4:
print('usage: python3', __file__, 'width height framerate html_port websocket_port')
print('example: python3', __file__, '640 480 30 6000 7000')
sys.exit(1)
width, height, framerate, html_port, ws_port = map(lambda s: int(s), sys.argv[1:])
html_server.html_port = html_port
html_server.ws_port = ws_port
print('Initialize camera')
camera = CameraStreaming(width, height, framerate)
print('Launch websocket server port', ws_port)
server = StreamingServer.new(ws_port)
StreamingServer.run_thread(server)
print('Launch HTML server port', html_port)
html_server.run_thread()
print('Streaming Start!')
camera.streaming(StreamingServer.send_data)