Browse Source

优化视频

master
胡超1 1 year ago
parent
commit
f1f4e3fac4
  1. 22
      CPF_Cef/AksVideoPlayer.cs
  2. 60
      CPF_Cef/Common/ChunkedUpload.cs
  3. 2
      CPF_Cef/Devices/PrintPJ.cs
  4. 3
      CPF_Cef/FrmMain.cs
  5. 65
      CPF_Cef/MainModel.cs

22
CPF_Cef/AksVideoPlayer.cs

@ -1,17 +1,9 @@
using System; using CPF;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CPF;
using CPF.Drawing;
using CPF.Controls;
using CPF.Shapes;
using CPF.Styling;
using CPF.Animation; using CPF.Animation;
using CPF.Svg; using CPF.Controls;
using CPF.Input; using CPF.Drawing;
using static System.Net.Mime.MediaTypeNames; using System;
using LibVLCSharp.Shared; using System.Text;
namespace AksWebBrowser namespace AksWebBrowser
{ {
@ -55,7 +47,7 @@ namespace AksWebBrowser
{ {
IsAntiAlias = true; IsAntiAlias = true;
CornerRadius = "3,3,3,3"; CornerRadius = "3,3,3,3";
Height = "360"; Height = "320";
Width = "640"; Width = "640";
Background = "#2c2c2c"; Background = "#2c2c2c";
ZIndex = 100; ZIndex = 100;
@ -65,7 +57,7 @@ namespace AksWebBrowser
MarginTop = 10f, MarginTop = 10f,
Classes = "imgAndText", Classes = "imgAndText",
FontFamily = "微软雅黑",//Alibaba PuHuiTi FontFamily = "微软雅黑",//Alibaba PuHuiTi
Text = "Close", Text = "X",
FontSize = 16, FontSize = 16,
Cursor = CPF.Cursors.Hand, Cursor = CPF.Cursors.Hand,
Foreground = Color.White, Foreground = Color.White,

60
CPF_Cef/Common/ChunkedUpload.cs

@ -7,6 +7,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -701,5 +702,64 @@ namespace AksWebBrowser.Common
} }
/// <summary>
/// 读取body数据
/// </summary>
/// <param name="type"></param>
/// <param name="typeCode"></param>
/// <param name="timeout"></param>
/// <returns></returns>
public async Task<string> ReadBody()
{
string body = string.Empty;
try
{
Init();
HttpClientHandler httpClientHandler = new HttpClientHandler();
httpClientHandler.ServerCertificateCustomValidationCallback = (message, cert, chain,
errors) => true;
HttpClient httpClient = new HttpClient(httpClientHandler);
Log.Info("开始读取body数据");
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("https://wsxf.gj.jcy/xfnwweb/nwxf/tyyw_kg_xfjsdj/ty_v2_zhcxeditform/get?openviewtag=READONLY&srfkey=2af82e4c14bfb5f34fe01f3ed98a9f16"),
Headers = {
{ "Authorization", "Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiLmnajpkat8NTEwMTkyIiwiZXhwIjoxNzE5MjExNzczLCJpYXQiOjE3MTkxOTczNzN9.y3rq49XSvCMFSb_RxX5SsuC13v_2CR1yG8WbztOsv2uhQS2UL8pP7IY2s2Rbg-G4e0Xz4dFg0Oc9TvvVqp4YAQ" },
{ "User-Agent", "Apipost/8 (https://www.apipost.cn)" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
body = await response.Content.ReadAsStringAsync();
}
Log.Info("结束读取body数据");
}
catch (Exception ex)
{
body=ex.Message;
}
return body;
}
public static void Init()
{
#if NETSTANDARD || NET5_0_OR_GREATER
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
#else
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3
| SecurityProtocolType.Tls
| SecurityProtocolType.Tls11
| SecurityProtocolType.Tls12;
#endif
ServicePointManager.ServerCertificateValidationCallback = (a, b, c, d) => { return true; };
ServicePointManager.CheckCertificateRevocationList = true;
ServicePointManager.DefaultConnectionLimit = 1000;
ServicePointManager.Expect100Continue = false;
}
} }
} }

2
CPF_Cef/Devices/PrintPJ.cs

@ -72,7 +72,7 @@ namespace AksWebBrowser.Devices
{ {
try try
{ {
string txt = string.Format(" 您预约办理的{0}业务-,排号为:", ywmc); string txt = string.Format(" 您预约办理的 {0} 业务,排号为:", ywmc);
LibPrint.SetClean(); LibPrint.SetClean();
LibPrint.SetReadZKmode(0); LibPrint.SetReadZKmode(0);
LibPrint.SetAlignment(0); LibPrint.SetAlignment(0);

3
CPF_Cef/FrmMain.cs

@ -4,6 +4,7 @@ using AKSWebBrowser.Commen;
using CPF; using CPF;
using CPF.Cef; using CPF.Cef;
using CPF.Controls; using CPF.Controls;
using CPF.Platform;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System; using System;
@ -86,10 +87,12 @@ namespace AksWebBrowser
Parame.webBrowser = FindPresenterByName<CusWebBrowser>(nameof(Parame.webBrowser)); Parame.webBrowser = FindPresenterByName<CusWebBrowser>(nameof(Parame.webBrowser));
textBox = FindPresenterByName<TextBox>(nameof(textBox)); textBox = FindPresenterByName<TextBox>(nameof(textBox));
Parame.webBrowser.CusRequest.CusResquestEvent += CusRequest_CusResquestEvent; Parame.webBrowser.CusRequest.CusResquestEvent += CusRequest_CusResquestEvent;
//浏览器大小 //浏览器大小
Parame.webBrowser.Width = w; Parame.webBrowser.Width = w;
Parame.webBrowser.Height = h; Parame.webBrowser.Height = h;
Parame.webBrowser.Url = "http://127.0.0.1:8096/#/main-out"; Parame.webBrowser.Url = "http://127.0.0.1:8096/#/main-out";
// Parame.webBrowser.Url = "http://192.168.0.232:8848/html/index.html";
//Parame.webBrowser.Url = "http://192.168.0.34:8078/#/main-out"; //Parame.webBrowser.Url = "http://192.168.0.34:8078/#/main-out";
//Parame.webBrowser.Url = Application.StartupPath + @"\html\index.html"; //Parame.webBrowser.Url = Application.StartupPath + @"\html\index.html";
//开发者工具暂时只能支持Windows //开发者工具暂时只能支持Windows

65
CPF_Cef/MainModel.cs

@ -3,6 +3,8 @@ using AksWebBrowser.Common;
using AksWebBrowser.Devices; using AksWebBrowser.Devices;
using AKSWebBrowser.Commen; using AKSWebBrowser.Commen;
using CPF; using CPF;
using CPF.Cef;
using CPF.Controls;
using CPF.Linux; using CPF.Linux;
using CPF.Windows; using CPF.Windows;
using Fleck; using Fleck;
@ -170,6 +172,10 @@ namespace AksWebBrowser
case "aks100118": case "aks100118":
result = SendSQ(content); result = SendSQ(content);
break; break;
//{"code":"aks100119"}
case "aks100119":
result = ReadByBody();
break;
default: default:
result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"无效指令\"}"; result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"keycode\":\"" + "" + "\",\"message\":\"Falied\",\"code\":\"400\",\"status\":false,\"data\":\"无效指令\"}";
break; break;
@ -671,7 +677,7 @@ namespace AksWebBrowser
} }
/// <summary> /// <summary>
/// aks100106指纹 (已国产化,未完成测试 /// aks100106指纹 (已国产化)
/// </summary> /// </summary>
/// <param name="paramsString"></param> /// <param name="paramsString"></param>
/// <returns></returns> /// <returns></returns>
@ -1075,7 +1081,8 @@ namespace AksWebBrowser
{ {
try try
{ {
Task.Run(() => { Task.Run(() =>
{
// 在你的窗口或应用程序需要时调用 // 在你的窗口或应用程序需要时调用
Bash("/usr/bin/python3 /usr/bin/onboard"); Bash("/usr/bin/python3 /usr/bin/onboard");
}); });
@ -1110,9 +1117,16 @@ namespace AksWebBrowser
} }
else else
{ {
Parame.frm.Invoke(() => //Parame.frm.Invoke(() =>
//{
// new AksVideoPlayer(Parame.frm, param.title, param.url);
//});
Task.Run(() =>
{ {
new AksVideoPlayer(Parame.frm, param.title, param.url); string command = $"pkill ffplay";
ShllCommad(command);
command = $"ffplay -fs -autoexit -window_title {param.title} -i {param.url}";
ShllCommad(command);
}); });
string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + "播放成功" + "\"}"; string result = "{\"timestamp\":\"" + Utils.GetTimestamp() + "\",\"message\":\"success\",\"code\":\"200\",\"status\":true,\"suffix\":\"jpg\",\"data\":\"" + "播放成功" + "\"}";
SubmitLogs(result, "playVideo"); SubmitLogs(result, "playVideo");
@ -2228,5 +2242,48 @@ namespace AksWebBrowser
process.WaitForExit(); process.WaitForExit();
} }
} }
public static string ReadByBody()
{
Task.Run(async () =>
{
GetReadBody();
});
@event11.WaitOne();
return body;
}
/// <summary>
/// 读取业务数据
/// </summary>
private static string body = string.Empty;
private static AutoResetEvent @event11 = new AutoResetEvent(false);
private static async void GetReadBody()
{
try
{
var httpClient = new HttpClient();
var uploader = new ChunkedUpload(httpClient);
body = await uploader.ReadBody();
@event11.Set();
}
catch (Exception ex)
{
Log.Error("读取业务数据异常:" + ex.Message);
}
}
[JSFunction]
public void test33(string code)
{
Parame.frm.Invoke(() =>
{
new AksVideoPlayer(Parame.frm, "rrr", "http://192.168.0.34:92/CaseFile/card/2024-06-03/20240603120112952.mp4");
});
}
} }
} }

Loading…
Cancel
Save