libushang 5 日 前
コミット
5bf5dc701e
1 ファイル変更17 行追加0 行削除
  1. 17 0
      routers/api/videoResource/hkvideo.py

+ 17 - 0
routers/api/videoResource/hkvideo.py

@@ -7,6 +7,7 @@ from utils import hk_video_api
 from common import PTZApi
 from utils.StripTagsHTMLParser import *
 import json
+from config import settings
 
 router = APIRouter()
 
@@ -25,6 +26,22 @@ async def get_video_url_by_id(
         "data": video_url
     }
 
+# 获取适合小屏播放的互联网代理地址
+@router.get('/proxy/get_video_url_by_id')
+async def get_video_url_by_id(
+    request: Request, 
+    id: str,
+    db: Session = Depends(get_db)
+):
+    video_url = hk_video_api.get_video_url(id=id, protocol='hlss')
+    video_url = video_url.replace("https://19.155.5.14:6014", f"{settings.YZY_WEB_ROOT}/hkvideo")
+    print('video_url', video_url)
+    return {
+        "code": 200,
+        "msg": "操作成功",
+        "data": video_url
+    }
+
 @router.get("/get_ptz_info")
 async def get_ptz_info(
     request: Request,