using System.Collections; using System.Collections.Generic; using System.IO; using UnityEngine; public class VideoPathUtil { private static string jarPrePath = "jar:file://"; private static string picoPath = "/storage/emulated/0/Download/dwkj_videos/"; public static string GetVideoUrlPath(string videoName) { #if UNITY_EDITOR return VideoPathUtil.GetPcVideoPath(videoName); #else return jarPrePath + GetFilePath(picoPath, videoName); #endif } private static string GetPcVideoPath() { return Path.GetFullPath(Application.streamingAssetsPath + "/../../Videos/"); } private static string GetPcVideoPath(string videoUrl) { return Path.Combine(VideoPathUtil.GetPcVideoPath(), $"{videoUrl}"); } private static string GetFilePath(string dirPath, string fileName) { DirectoryInfo direction = new DirectoryInfo(dirPath); FileInfo[] files = direction.GetFiles(); foreach (var file in files) { string str = file.Name; string str2 = $"{fileName}" ; if (str == str2) return file.FullName; } return ""; } }