gpt4 book ai didi

javascript - Javascript和Cordova:声音不起作用

转载 作者:行者123 更新时间:2023-12-03 01:51:38 26 4
gpt4 key购买 nike

JavaScript中的这段非常简单的代码在Cordova中不起作用,有什么想法吗?

<head>
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<link rel="stylesheet" type="text/css" href="css/index.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<title>Hello World</title>
<link type="text/css" rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.1/css/bootstrap.min.css" />

<style>
nav#nav1{margin-top: 24px;}
nav#nav1 > a{ background:#B9E1FF; color:#000; padding:10px; text-decoration:none; border-radius:5px; font-family:"Arial Black", Gadget, sans-serif; }
nav#nav1 > a:hover{ background: #BBEA00; }
nav#nav1 > a:active{ background: #EEFFA8; }
</style>
<script>
var bleep = new Audio();
bleep.src = 'bleep.mp3';
</script>
</head>
<body>
<div class="container">
<nav id="nav1">
<a href="#" onmousedown="bleep.play()">Home</a>
<a href="#" onmousedown="bleep.play()">About Us</a>
<a href="#" onmousedown="bleep.play()">Services</a>
<a href="#" onmousedown="bleep.play()">Contact</a>
</nav>
</div>

非常感谢!

最佳答案

您能否链接用于Audio()对象的插件。

Cordova文档使用“Media”:
https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-media/

如果您使用此插件,应该会得到更好的结果!

关于javascript - Javascript和Cordova:声音不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39235892/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com