From 96358b1e042ad9cfe8d52c3ad56ddd8bfa162399 Mon Sep 17 00:00:00 2001 From: chenxiangxue <910695411@qq.com> Date: Fri, 18 Oct 2024 18:38:37 +0800 Subject: [PATCH] adadaa --- .../Prefabs/UI/WebVideo/VideoWebPage.prefab | 4 +- .../wj/Table&Chart/VideoPage/VideoWebPage.cs | 50 +++++++++++++++++-- .../Assets/StreamingAssets/configure_api.json | 2 +- .../StreamingAssets/configure_camera.json | 16 +++--- 4 files changed, 58 insertions(+), 14 deletions(-) diff --git a/BulkCargo_UnityProject/Assets/Resources/Prefabs/UI/WebVideo/VideoWebPage.prefab b/BulkCargo_UnityProject/Assets/Resources/Prefabs/UI/WebVideo/VideoWebPage.prefab index 7dfa20e8..1467f5fd 100644 --- a/BulkCargo_UnityProject/Assets/Resources/Prefabs/UI/WebVideo/VideoWebPage.prefab +++ b/BulkCargo_UnityProject/Assets/Resources/Prefabs/UI/WebVideo/VideoWebPage.prefab @@ -147,8 +147,8 @@ MonoBehaviour: transparency: 0 alphaPacking: 0 stereoPacking: 0 - _autoOpen: 1 - _autoPlayOnStart: 1 + _autoOpen: 0 + _autoPlayOnStart: 0 _loop: 1 _audioVolume: 1 _audioBalance: 0 diff --git a/BulkCargo_UnityProject/Assets/Scripts/wj/Table&Chart/VideoPage/VideoWebPage.cs b/BulkCargo_UnityProject/Assets/Scripts/wj/Table&Chart/VideoPage/VideoWebPage.cs index f00ce957..de13429c 100644 --- a/BulkCargo_UnityProject/Assets/Scripts/wj/Table&Chart/VideoPage/VideoWebPage.cs +++ b/BulkCargo_UnityProject/Assets/Scripts/wj/Table&Chart/VideoPage/VideoWebPage.cs @@ -7,6 +7,11 @@ using TMPro; using ZenFulcrum.EmbeddedBrowser; using Competition.Mysql.Model; using RenderHeads.Media.AVProVideo; +using Newtonsoft.Json; +using static ZenFulcrum.EmbeddedBrowser.Browser; +using UnityEditor.Rendering; +using Newtonsoft.Json.Linq; +using System.Net; /* * @@ -86,8 +91,47 @@ public class VideoWebPage : PanelBase //WebPage.Url = ApiManager.Instance.ApiDic["VideoWebUrl"] + "?src=http://playertest.longtailvideo.com/adaptive/bipbop/gear4/prog_index.m3u8"; - - //avpro - mediaPlayer.OpenMedia(new MediaPath("http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear2/prog_index.m3u8", MediaPathType.AbsolutePathOrURL),true); + string postUrl = ApiManager.Instance.ApiDic["VideoWebUrl"]; + MyData myData = new MyData(); + Data data = new Data(); + data.cameraIndexCode = "35162241101320503007"; + data.protocol = "hls"; + myData.path = "/artemis/api/video/v2/cameras/previewURLs"; + myData.data = data; + StartCoroutine(RequestBase.Post(postUrl, JsonConvert.SerializeObject(myData), (_data, _error) => + { + if (_error != null) + { + Debug.Log($"模糊查询接口错误: {_error} "); + } + else + { + Debug.Log("接口返回值: " + _data); + JObject jo = JObject.Parse(_data); + if (jo["code"].ToObject() == 0) + { + mediaPlayer.OpenMedia(new MediaPath(jo["result"]["data"]["url"].ToString(), MediaPathType.AbsolutePathOrURL), true); + Debug.Log("播放画面"); + } + } + })); } } + +public class MyData +{ + public string path; + public Data data; +} +public class Data +{ + public string cameraIndexCode; + public string protocol; +} + +public class MyResult +{ + public int code; + public string type; + public string result; +} \ No newline at end of file diff --git a/BulkCargo_UnityProject/Assets/StreamingAssets/configure_api.json b/BulkCargo_UnityProject/Assets/StreamingAssets/configure_api.json index d307e369..030af307 100644 --- a/BulkCargo_UnityProject/Assets/StreamingAssets/configure_api.json +++ b/BulkCargo_UnityProject/Assets/StreamingAssets/configure_api.json @@ -16,5 +16,5 @@ "GetBoCiByYear": "/api/Storage/GetBoCiByYear", "GetInNumByYear": "/api/Storage/GetInNumByYear", "GetInNumWithCurrent": "/api/Storage/GetInNumWithCurrent", - "VideoWebUrl": "http://111.229.30.246:4001/demo.html" + "VideoWebUrl": "http://127.0.0.1:12307/cameras/hikvision/" } \ No newline at end of file diff --git a/BulkCargo_UnityProject/Assets/StreamingAssets/configure_camera.json b/BulkCargo_UnityProject/Assets/StreamingAssets/configure_camera.json index bce3fd1b..4ffa8a1a 100644 --- a/BulkCargo_UnityProject/Assets/StreamingAssets/configure_camera.json +++ b/BulkCargo_UnityProject/Assets/StreamingAssets/configure_camera.json @@ -2,14 +2,14 @@ { "MONITOR_ID": "CNMAW350015", "DATA": { - "01": "Camera000100", - "02": "Camera000101", - "03": "Camera000102", - "04": "Camera000103", - "05": "Camera000104", - "06": "Camera000105", - "07": "Camera000106", - "08": "Camera000107", + "01": "Camera000591", + "02": "Camera000592", + "03": "Camera000593", + "04": "", + "05": "", + "06": "", + "07": "", + "08": "", "09": "", "10": "", "11": "",