|
@@ -8,6 +8,7 @@ using DG.Tweening;
|
|
|
using Newtonsoft.Json;
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
using UnityEngine;
|
|
|
+using System.Security.Cryptography;
|
|
|
using RenderHeads.Media.AVProVideo;
|
|
|
using UnityEngine.Networking;
|
|
|
using UnityEngine.UI;
|
|
@@ -157,17 +158,23 @@ public class ObsPlayerPanel : MonoBehaviour
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void Close()
|
|
|
+ public static string GetHashedName(string originalName)
|
|
|
{
|
|
|
- Debug.Log(openSuccess);
|
|
|
- if (openSuccess)
|
|
|
+ using (SHA256 sha256 = SHA256.Create())
|
|
|
{
|
|
|
- Texture2D saveTex = new Texture2D(704, 576);
|
|
|
- obsPlayer.ExtractFrame(saveTex);
|
|
|
- Debug.Log(saveTex.width);
|
|
|
- Debug.Log(saveTex.height);
|
|
|
- HttpHelper._Instance.SaveFirstFrame(saveTex.EncodeToJPG(), $"{_targetName}.jpg", _targetName);
|
|
|
+ byte[] hash = sha256.ComputeHash(Encoding.UTF8.GetBytes(originalName));
|
|
|
+ return BitConverter.ToString(hash).Replace("-", "").ToLower();
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public void Close()
|
|
|
+ {
|
|
|
+ Texture2D saveTex = new Texture2D(704, 576);
|
|
|
+ obsPlayer.ExtractFrame(saveTex);
|
|
|
+ string hashName = GetHashedName(_targetName);
|
|
|
+
|
|
|
+ HttpHelper._Instance.SaveFirstFrame(saveTex.EncodeToJPG(), $"{hashName}.jpg", hashName);
|
|
|
obsPlayer.Control.Stop();
|
|
|
currentChannelId = "";
|
|
|
this.gameObject.SetActive(false);
|
|
@@ -274,7 +281,8 @@ public class ObsPlayerPanel : MonoBehaviour
|
|
|
{
|
|
|
Texture2D saveTex = new Texture2D(704, 576);
|
|
|
obsPlayer.ExtractFrame(saveTex);
|
|
|
- StartCoroutine(UpLoadFile(saveTex.EncodeToJPG(), $"{obsName}{GetCurrentUnixTimestampMillis()}.jpg"));
|
|
|
+ string hashName = GetHashedName(obsName);
|
|
|
+ StartCoroutine(UpLoadFile(saveTex.EncodeToJPG(), $"{obsName}_{GetCurrentUnixTimestampMillis()}.jpg"));
|
|
|
}
|
|
|
public string ConvertToUnicode(string input)
|
|
|
{
|