我们正在开发一个应用程序来管理基于IP网络扬声器的商店中的声音(紧急,促销,播放列表......)。
目前,我们无法通过点击网页上的“播放”按钮找到使用IP x.x.x.x在扬声器上播放声音的解决方案。
以下设置有效(播放声音),但它总是在我们的浏览器中打开一个新标签。我们希望以“隐藏”方式播放声音(不会打开单独的选项卡/窗口/无论如何),而是在现有页面的背景中播放。 同样适用于我们的“停止”按钮(这也在单独的选项卡中打开)
这是我们正在使用的HTML代码(我删除了所有图标等等)
<tr>
<td>Fire evacuation</td>
<td><div class= "tag-emergency"><i class="fas fa-fire"></i> Emergency</div></td>
<td><a href="http://x.x.x.x/axis-cgi/playclip.cgi?clip=3" class="w3-bar-item w3-button w3-padding play"><i class="fas fa-play fa-fw"></i></a></td>
<td><a href="http://x.x.x.x/axis-cgi/mediaclip.cgi?action=stop" class="w3-bar-item w3-button w3-padding stop"><i class="fas fa-stop fa-fw"></i></a></td>
</tr>
有人知道怎么做吗?
谢谢!
尼科
答案 0 :(得分:0)
如果我理解正确,你可以用AJAX做到这一点。对于一个Button,它看起来应该是这样的:
document.getElementById("yourButtonClass").onclick = function(e) {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
var response = xmlhttp.responseText;
}
}
xmlhttp.open("GET","http://x.x.x.x/axis-cgi/playclip.cgi?clip=3",true);
xmlhttp.send();
};
和HTML:
<td><a class="w3-bar-item w3-button w3-padding play yourButtonClass"><i class="fas fa-play fa-fw"></i></a></td>
答案 1 :(得分:0)
我今天也得到了Axis的回答(供应商网络发言人):
由于使用了VAPIX命令,正在打开新选项卡。这些始终在新标签页中打开。
那么我们可以使用您认为的Ajax方法解决方法吗?
谢谢,
尼科