Skip to content

Commit

Permalink
* optimize rtmp demo
Browse files Browse the repository at this point in the history
  • Loading branch information
lxowalle committed Jul 2, 2024
1 parent a467d65 commit 5e91226
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions examples/vision/streaming/rtmp_stream.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from maix import camera, time, app, rtmp, image

cam = camera.Camera(320, 240, image.Format.FMT_YVU420SP)

host="192.168.0.30"
port=1935
app_name="live"
stream_name="stream"
client = rtmp.Rtmp(host, port, app_name, stream_name)
client.bind_camera(cam)
client.start()

print(f"rtmp://{host}:{port}/{app_name}/{stream_name}")
while not app.need_exit():
time.sleep(1)
4 changes: 2 additions & 2 deletions projects/app_rtmp_live/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def parse_url(url):
base_img.draw_string(0, int(base_img.height() * 0.70), "URL:", color, 2)
base_img.draw_string(url_x, int(base_img.height() * 0.70) + str_height_2 + 10, global_url, color)

box = [20, 20, img_exit.width(), img_exit.height()]
box = [20, 15, img_exit.width(), img_exit.height()]
if touch_box(t, box, 20):
base_img.draw_image(box[0], box[1], img_exit_touch)
need_exit = True
Expand Down Expand Up @@ -228,7 +228,7 @@ def parse_url(url):
base_img.draw_string(str_rtmp_is_running_x, int(base_img.height() * 0.7), str_rtmp_is_running3, color, 2)

need_exit = False
box = [20, 20, img_exit.width(), img_exit.height()]
box = [20, 15, img_exit.width(), img_exit.height()]
if touch_box(t, box, 20):
base_img.draw_image(box[0], box[1], img_exit_touch)
need_exit = True
Expand Down

0 comments on commit 5e91226

Please sign in to comment.