Javascript phonegap 4.0媒体插件引用错误:未定义媒体

Javascript phonegap 4.0媒体插件引用错误:未定义媒体,javascript,cordova,audio,Javascript,Cordova,Audio,我对编程相当陌生,我正在尝试构建我的第一个phonegap应用程序。我正在尝试播放我的/www/sounds/文件夹中的一些声音。但是,当我在浏览器(chrome)中运行index.html时,会出现“未捕获引用错误:未定义媒体”错误 这是我的HTML: <html> <head> <meta charset="utf-8" /> <meta name="format-detection" content="telephone=no" /

我对编程相当陌生,我正在尝试构建我的第一个phonegap应用程序。我正在尝试播放我的/www/sounds/文件夹中的一些声音。但是,当我在浏览器(chrome)中运行index.html时,会出现“未捕获引用错误:未定义媒体”错误

这是我的HTML:

<html>
<head>
    <meta charset="utf-8" />
    <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, height=device-height, target-densitydpi=device-dpi" />
    <link rel="stylesheet" type="text/css" href="css/index.css" />
    <!--jQuery mobile-->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
    <script src="http://code.jquery.com/jquery-1.11.2.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>

    <script type="text/javascript" src="cordova.js"></script>
   <script type="text/javascript" src="js/index.js"></script>
</head>
<body>


<div id="files-list-page" data-role="page">
    <header data-role="header">
        <h1>Fragmenten</h1>
    </header>
    <div data-role="content">
        <ul id="files-list" data-role="listview" data-autodividers="true" data-filter="false" data-split-icon="delete">
            <audio id="fr1" src="sounds/5euros.mp3" type="audio/mp3" ></audio>
        </ul>
        <button id="btn1" class=ui-btn" onclick="playAudio('sounds/5euros.mp3')">Play</button>
    </div>
    <footer data-role="footer">
        <h3 id="copyright-title">Soundboard</h3>
    </footer>
</div>

</body>
My config.xml:

    <?xml version='1.0' encoding='utf-8'?>
<widget id="com.martijn.HuisbaasBob" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>HuisbaasBob</name>
    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <author email="dev@cordova.apache.org" href="http://cordova.io">
        Apache Cordova Team
    </author>
    <content src="index.html" />
    <access origin="*" />
</widget>

哈伊斯巴斯波
响应deviceready事件的Apache Cordova应用程序示例。
阿帕奇科尔多瓦团队

任何建议都会有很大帮助,提前谢谢!

您需要在ur config.xml中添加这几行代码,以使插件正常工作

(在app/res/xml/config.xml中)



“未捕获引用错误:未定义媒体”表示您的代码无法识别它…表示“未配置”

您安装媒体插件了吗?是的,我安装了,使用CLI:cordova plugin add org.apache.cordova.mediaCheck“config.xml“无论配置是否正确。或者只是分享你的config.xml发布了我的config.xml,这是非常基本的,我没有改变任何东西。我发现通过CLI安装插件在我的项目中导入了插件。Phonegap插件在浏览器中不起作用。你需要用一个设备来测试。嘿,那不行。或者我应该先尝试构建应用程序吗?那么你在哪里运行呢?在计算机浏览器中?
    <?xml version='1.0' encoding='utf-8'?>
<widget id="com.martijn.HuisbaasBob" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>HuisbaasBob</name>
    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <author email="dev@cordova.apache.org" href="http://cordova.io">
        Apache Cordova Team
    </author>
    <content src="index.html" />
    <access origin="*" />
</widget>
<feature name="Media">
    <param name="android-package" value="org.apache.cordova.media.AudioHandler" />
</feature>