{"id":186107,"date":"2023-07-24T12:37:02","date_gmt":"2023-07-24T04:37:02","guid":{"rendered":"http:\/\/www.idc.net\/help\/186107\/"},"modified":"2023-07-24T12:37:02","modified_gmt":"2023-07-24T04:37:02","slug":"%e5%90%8e%e6%b5%aa%e4%ba%91%e7%99%be%e5%ba%a6%e5%b0%8f%e7%a8%8b%e5%ba%8f%e6%95%99%e7%a8%8b%ef%bc%9aaudio-%e9%9f%b3%e9%a2%91","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/186107\/","title":{"rendered":"\u540e\u6d6a\u4e91\u767e\u5ea6\u5c0f\u7a0b\u5e8f\u6559\u7a0b\uff1aaudio \u97f3\u9891"},"content":{"rendered":"<ul>\n<li>audio \u97f3\u9891\n<ul>\n<li>\u5c5e\u6027\u8bf4\u660e\n<ul>\n<li>MediaError.code<\/li>\n<\/ul>\n<\/li>\n<li>\u793a\u4f8b\n<ul>\n<li>\u4ee3\u7801\u793a\u4f8b\n<ul><\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h1><span><\/span>audio \u97f3\u9891<\/h1>\n<p><strong>\u89e3\u91ca<\/strong>\uff1a\u97f3\u9891\u3002<\/p>\n<h2><span><\/span>\u5c5e\u6027\u8bf4\u660e<\/h2>\n<table>\n<thead>\n<tr>\n<th>\u5c5e\u6027\u540d<\/th>\n<th>\u7c7b\u578b<\/th>\n<th>\u9ed8\u8ba4\u503c<\/th>\n<th>\u5fc5\u586b<\/th>\n<th>\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\n<p>id<\/p>\n<\/td>\n<td>\n<p>String<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>\u5426<\/p>\n<\/td>\n<td>\n<p>audio \u7ec4\u4ef6\u7684\u552f\u4e00\u6807\u8bc6\u7b26<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>src<\/p>\n<\/td>\n<td>\n<p>String<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>\u5426<\/p>\n<\/td>\n<td>\n<p>\u8981\u64ad\u653e\u97f3\u9891\u7684\u8d44\u6e90\u5730\u5740<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>loop<\/p>\n<\/td>\n<td>\n<p>Boolean<\/p>\n<\/td>\n<td>\n<p>false<\/p>\n<\/td>\n<td>\n<p>\u5426<\/p>\n<\/td>\n<td>\n<p>\u662f\u5426\u5faa\u73af\u64ad\u653e<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>controls<\/p>\n<\/td>\n<td>\n<p>Boolean<\/p>\n<\/td>\n<td>\n<p>false<\/p>\n<\/td>\n<td>\n<p>\u5426<\/p>\n<\/td>\n<td>\n<p>\u662f\u5426\u663e\u793a\u9ed8\u8ba4\u63a7\u4ef6<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>poster<\/p>\n<\/td>\n<td>\n<p>String<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>\u5426<\/p>\n<\/td>\n<td>\n<p>\u9ed8\u8ba4\u63a7\u4ef6\u4e0a\u7684\u97f3\u9891\u5c01\u9762\u7684\u56fe\u7247\u8d44\u6e90\u5730\u5740\uff0c\u5982\u679c controls \u5c5e\u6027\u503c\u4e3a false \u5219\u8bbe\u7f6e poster \u65e0\u6548<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>name<\/p>\n<\/td>\n<td>\n<p>String<\/p>\n<\/td>\n<td>\n<p>\u672a\u77e5\u97f3\u9891<\/p>\n<\/td>\n<td>\n<p>\u5426<\/p>\n<\/td>\n<td>\n<p>\u9ed8\u8ba4\u63a7\u4ef6\u4e0a\u7684\u97f3\u9891\u540d\u5b57\uff0c\u5982\u679c controls \u5c5e\u6027\u503c\u4e3a false \u5219\u8bbe\u7f6e name \u65e0\u6548<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>author<\/p>\n<\/td>\n<td>\n<p>String<\/p>\n<\/td>\n<td>\n<p>\u672a\u77e5\u4f5c\u8005<\/p>\n<\/td>\n<td>\n<p>\u5426<\/p>\n<\/td>\n<td>\n<p>\u9ed8\u8ba4\u63a7\u4ef6\u4e0a\u7684\u4f5c\u8005\u540d\u5b57\uff0c\u5982\u679c controls \u5c5e\u6027\u503c\u4e3a false \u5219\u8bbe\u7f6e author \u65e0\u6548<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>binderror<\/p>\n<\/td>\n<td>\n<p>EventHandle<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>\u5426<\/p>\n<\/td>\n<td>\n<p>\u5f53\u53d1\u751f\u9519\u8bef\u65f6\u89e6\u53d1 error \u4e8b\u4ef6\uff0c<code>detail = {errMsg: MediaError.code}<\/code>\u8fd4\u56de\u9519\u8bef\u7801\u53ef\u53c2\u8003 MediaError.code<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>bindplay<\/p>\n<\/td>\n<td>\n<p>EventHandle<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>\u5426<\/p>\n<\/td>\n<td>\n<p>\u5f53\u5f00\u59cb\/\u7ee7\u7eed\u64ad\u653e\u65f6\u89e6\u53d1 play \u4e8b\u4ef6\uff0c<code>detail = {duration}<\/code><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>bindpause<\/p>\n<\/td>\n<td>\n<p>EventHandle<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>\u5426<\/p>\n<\/td>\n<td>\n<p>\u5f53\u6682\u505c\u64ad\u653e\u65f6\u89e6\u53d1 pause \u4e8b\u4ef6\uff0c<code>detail = {duration}<\/code><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>bindtimeupdate<\/p>\n<\/td>\n<td>\n<p>EventHandle<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>\u5426<\/p>\n<\/td>\n<td>\n<p>\u5f53\u64ad\u653e\u8fdb\u5ea6\u6539\u53d8\u65f6\u89e6\u53d1 timeupdate \u4e8b\u4ef6\uff0c<code>detail = {currentTime, duration}<\/code><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>bindended<\/p>\n<\/td>\n<td>\n<p>EventHandle<\/p>\n<\/td>\n<td><\/td>\n<td>\n<p>\u5426<\/p>\n<\/td>\n<td>\n<p>\u5f53\u64ad\u653e\u5230\u672b\u5c3e\u65f6\u89e6\u53d1 ended \u4e8b\u4ef6\uff0c<code>detail = {duration}<\/code><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><span><\/span>MediaError.code<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u8fd4\u56de\u9519\u8bef\u7801<\/th>\n<th>\u63cf\u8ff0<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>1<\/td>\n<td>\u83b7\u53d6\u8d44\u6e90\u8fc7\u7a0b\u88ab\u7528\u6237\u7ec8\u6b62<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>\u7f51\u7edc\u9519\u8bef<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>\u5f53\u89e3\u7801\u65f6\u53d1\u751f\u9519\u8bef<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>\u4e0d\u652f\u6301\u97f3\u9891<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><span><\/span>\u793a\u4f8b<\/h2>\n<p>\u8df3\u8f6c\u7f16\u8f91\u5de5\u5177<\/p>\n<p>\u5728\u5f00\u53d1\u8005\u5de5\u5177\u4e2d\u6253\u5f00<\/p>\n<p>\u5728 WEB IDE \u4e2d\u6253\u5f00<\/p>\n<p>\u626b\u7801\u4f53\u9a8c<\/p>\n<p>\u4ee3\u7801\u793a\u4f8b<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/static.sitestack.cn\/projects\/smartprogram-20210306\/97ebf63311ffac886baad1c970c1b97b.png\" class=\"aligncenter\"><\/p>\n<p>\u8bf7\u4f7f\u7528\u767e\u5ea6APP\u626b\u7801<\/p>\n<h3><span><\/span>\u4ee3\u7801\u793a\u4f8b<\/h3>\n<ul>\n<li>SWAN<\/li>\n<li>JS<\/li>\n<\/ul>\n<pre>\n \n \n <ol>\n  \n  \n  <li><code><span>&lt;audio<\/span><span> <\/span><\/code><\/li>\n  \n  \n  <li><code><span> <\/span><span>poster<\/span><span>=<\/span><span>\"{{poster}}\"<\/span><span> <\/span><\/code><\/li>\n  \n  \n  <li><code><span> <\/span><span>name<\/span><span>=<\/span><span>\"{{name}}\"<\/span><span> <\/span><\/code><\/li>\n  \n  \n  <li><code><span> <\/span><span>loop<\/span><span>=<\/span><span>\"false\"<\/span><span> <\/span><\/code><\/li>\n  \n  \n  <li><code><span> <\/span><span>author<\/span><span>=<\/span><span>\"{{author}}\"<\/span><span> <\/span><\/code><\/li>\n  \n  \n  <li><code><span> <\/span><span>src<\/span><span>=<\/span><span>\"{{src}}\"<\/span><span> <\/span><\/code><\/li>\n  \n  \n  <li><code><span> <\/span><span>id<\/span><span>=<\/span><span>\"myAudio\"<\/span><span> <\/span><\/code><\/li>\n  \n  \n  <li><code><span> <\/span><span>controls<\/span><span> <\/span><\/code><\/li>\n  \n  \n  <li><code><span> <\/span><span>bind:error<\/span><span>=<\/span><span>\"audioError\"<\/span><span> <\/span><\/code><\/li>\n  \n  \n  <li><code><span> <\/span><span>bind:play<\/span><span>=<\/span><span>\"audioPlay\"<\/span><span> <\/span><\/code><\/li>\n  \n  \n  <li><code><span> <\/span><span>bind:pause<\/span><span>=<\/span><span>\"audioPause\"<\/span><span> <\/span><\/code><\/li>\n  \n  \n  <li><code><span> <\/span><span>bind:timeupdate<\/span><span>=<\/span><span>\"audioTimeUpdate\"<\/span><span> <\/span><\/code><\/li>\n  \n  \n  <li><code><span> <\/span><span>bind:ended<\/span><span>=<\/span><span>\"audioEnded\"<\/span><span>&gt;<\/span><\/code><\/li>\n  \n  \n  <li><code><span>&lt;\/audio&gt;<\/span><\/code><\/li>\n \n \n <\/ol><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>audio \u97f3\u9891 \u5c5e\u6027\u8bf4\u660e MediaError.code \u793a\u4f8b \u4ee3\u7801\u793a\u4f8b audio \u97f3\u9891 \u89e3\u91ca\uff1a\u97f3\u9891\u3002 \u5c5e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":186108,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[182398],"tags":[],"class_list":["post-186107","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mini-program"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/186107","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=186107"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/186107\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media\/186108"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=186107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=186107"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=186107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}