我遇到了这个javascript函数的问题
List<IPAddress> localIPs = new List<IPAddress>();
var ifaces = NetworkInterface.GetAllNetworkInterfaces();
//I'm working on unity and it does not allow me to do .ToList().. for some reason.
List<NetworkInterface> IfacesList = new List<NetworkInterface>();
foreach (var i in ifaces)
IfacesList.Add(i);
var selected = IfacesList.FindAll(x => x.NetworkInterfaceType == NetworkInterfaceType.Ethernet);
if (selected.Count == 1)
{
var addresses = selected[0].GetIPProperties().UnicastAddresses;
//once again, cannot use .toList()
List<UnicastIPAddressInformation> addressesList = new List<UnicastIPAddressInformation>();
foreach (var address in addresses)
addressesList.Add(address);
var ip = addressesList.Find(x => x.Address.AddressFamily == AddressFamily.InterNetwork).Address;
return new IPEndPoint(ip, port);
}
else
{
//HERE I need to differentiate my IP from VPN IP
}
在图片滑块中调用此函数,p是标识符int。如果返回错误,它会更改音频标签src,播放或触发单击(我不使用ajax来检查文件是否存在)。
问题是,如果文件实际上不存在,它会获取文件夹中的另一个文件并播放它。它应该只返回一个错误,但它不会...为什么我没有要求的其他文件被播放?怎么避免这个?
我的音频文件夹类似于:1_FR.mp3,3_FR.mp3等。
由于
答案 0 :(得分:0)
似乎是一个缓存问题,我终于在这个线程HTML5 Audio. Replacing Element still the same audio file (cached) how to solve?
上找到了解决方案在我的代码中,我刚刚在音频文件名之后添加了一个参数,它解决了问题
$("#audiovoix").attr("src", "fiches_visite/"+id+"/audio/"+p+"_FR.mp3?cache-buster=" + new Date().getTime());