{"id":5351,"date":"2019-12-18T18:55:00","date_gmt":"2019-12-18T09:55:00","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=5351"},"modified":"2019-12-18T18:55:00","modified_gmt":"2019-12-18T09:55:00","slug":"javascript%e3%81%a0%e3%81%91%ef%bc%81%e3%83%96%e3%83%a9%e3%82%a6%e3%82%b6%e3%81%a7%e9%8c%b2%e9%9f%b3%ef%bc%86%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e4%bf%9d%e5%ad%98%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=5351","title":{"rendered":"JavaScript\u3060\u3051\uff01\u30d6\u30e9\u30a6\u30b6\u3067\u9332\u97f3\uff06\u30d5\u30a1\u30a4\u30eb\u4fdd\u5b58\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u524d\u3005\u56de\u3001<a href=\"https:\/\/blog.capilano-fw.com\/?p=5330\">\u610f\u5916\u3068\u7c21\u5358\uff01\u97f3\u3092\u611f\u77e5\u3057\u3066\u9332\u753b\u3059\u308b\u76e3\u8996\u30ab\u30e1\u30e9\u3092\u3064\u304f\u308b<\/a>\u3067\u306f\u3001<code>Python<\/code>\u3067\u5927\u304d\u306a\u97f3\u3092\u611f\u77e5\u3057\u3066\u9332\u753b\u3059\u308b\u3068\u3044\u3046\u6a5f\u80fd\u3092\u3064\u304f\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u306a\u305c<code>Python<\/code>\u3067\u4f5c\u3063\u305f\u304b\u3068\u8a00\u3046\u3068\u3001\u8a18\u4e8b\u306e\u4e2d\u3067\u3082\u66f8\u3044\u305f\u3068\u304a\u308a<code>JavaScript<\/code>\u3067\u97f3\u91cf\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b\u65b9\u6cd5\u304c\u898b\u3064\u304b\u3089\u306a\u304b\u3063\u305f\u306e\u3067\u4ed5\u65b9\u306a\u304f\u3001\u3001\u3068\u3044\u3063\u305f\u90e8\u5206\u304c\u3042\u3063\u305f\u304b\u3089\u3067\u3057\u305f\u3002\uff08\u3082\u3057\u3054\u5b58\u77e5\u306e\u65b9\u304c\u3044\u3089\u3063\u3057\u3083\u3063\u305f\u3089\u3001\u305c\u3072\u6559\u3048\u3066\u304f\u3060\u3055\u3044m_ _m\uff09<\/p>\n<p>\u305d\u3057\u3066\u3001\u3053\u306e\u4ef6\u306e\u8abf\u67fb\u3067\u77e5\u308b\u3053\u3068\u306b\u306a\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u306a\u3093\u3068\u3001<\/p>\n<p><strong style=\"font-size: 35px;\">\u30d6\u30e9\u30a6\u30b6\u3060\u3051\u3067\u9332\u97f3\u3092\u3057\u3001\u3055\u3089\u306b\u305d\u308c\u3092\u30d5\u30a1\u30a4\u30eb\u3068\u3057\u3066\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b<\/strong><\/p>\n<p>\u3088\u3046\u306a\u306e\u3067\u3001\u4eca\u56de\u306f\u3053\u306e\u6a5f\u80fd\u3092\u3054\u7d39\u4ecb\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u7686\u3055\u3093\u306e\u304a\u5f79\u306b\u7acb\u3066\u308b\u3068\u5b09\u3057\u3044\u3067\u3059\ud83d\ude0a\u2728<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2597 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/11\/15-2.png\" alt=\"\" width=\"275\" height=\"350\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/11\/15-2.png 275w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/11\/15-2-236x300.png 236w\" sizes=\"auto, (max-width: 275px) 100vw, 275px\" \/><\/p>\n<p><strong>\u958b\u767a\u74b0\u5883\uff1a<\/strong> Vue 2.6<\/p>\n<h1>\u524d\u63d0\u3068\u3057\u3066<\/h1>\n<p>\u4eca\u56de\u306e\u6a5f\u80fd\u3092\u5b9f\u88c5\u3059\u308b\u305f\u3081\u306b\u306f\u3001\u30de\u30a4\u30af\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u305d\u3057\u3066\u3001<code>Google Chrome<\/code>\u304b\u3089\u30de\u30a4\u30af\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u305f\u3081\u306b\u306f\u3001\u305f\u3068\u3048\u30ed\u30fc\u30ab\u30eb\u74b0\u5883\u3067\u3042\u3063\u3066\u3082<code>HTTPS<\/code>\u63a5\u7d9a\u304c\u5fc5\u9808\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u307e\u3060<code>HTTPS<\/code>\u63a5\u7d9a\u3092\u6e96\u5099\u3057\u3066\u3044\u306a\u3044\u65b9\u306f\u5148\u306b\u305d\u3061\u3089\u3092\u7528\u610f\u3057\u3066\u304b\u3089\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u306a\u304a\u3001<code>nginx<\/code>\u306e\u5834\u5408\u306f\u4ee5\u4e0b\u306e\u8a18\u4e8b\u3092\u53c2\u8003\u306b\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><a href=\"https:\/\/blog.capilano-fw.com\/?p=2228\">\u30b3\u30d4\u30da\u3067OK\uff01\u30ed\u30fc\u30ab\u30eb\u74b0\u5883\u306bHTTPS\u3092\u5c0e\u5165\u3059\u308b\uff08nginx\u7de8\uff09<\/a><\/p>\n<h1>\u30b3\u30fc\u30c9\u3092\u3064\u304f\u3063\u3066\u3044\u304f<\/h1>\n<p>\u4eca\u56de\u306f\u7279\u306b\u30b3\u30fc\u30c9\u304c\u77ed\u3044\u306e\u3067\u3001\u57fa\u672c\u30b3\u30fc\u30c9\u306e\u756a\u53f7\u3092\u5404\u30b3\u30fc\u30c9\u3068\u5165\u308c\u66ff\u3048\u308b\u3068\u5b8c\u6210\u3059\u308b\u300c\u5b66\u7fd2\u96d1\u8a8c\u306e\u4ed8\u9332\u300d\u5f62\u5f0f\u3067\u304a\u5c4a\u3051\u3057\u307e\u3059\u3002<\/p>\n<h2>\u57fa\u672c\u30b3\u30fc\u30c9<\/h2>\n<p>\u3067\u306f\u307e\u305a\u306f\u57fa\u672c\u30b3\u30fc\u30c9\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u306e\u4e2d\u306b\u66f8\u304b\u308c\u3066\u3044\u308b\u2460\u301c\u2464\u306e\u5834\u6240\u306b\u3053\u308c\u304b\u3089\u8aac\u660e\u3057\u3066\u3044\u304f\u30b3\u30fc\u30c9\u3092\u30bb\u30c3\u30c8\u3057\u3066\u3044\u3063\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre>&lt;html&gt;\r\n&lt;head&gt;\r\n    &lt;link href=\"https:\/\/stackpath.bootstrapcdn.com\/bootstrap\/4.4.1\/css\/bootstrap.min.css\" rel=\"stylesheet\"&gt;\r\n&lt;\/head&gt;\r\n&lt;body class=\"p-3\"&gt;\r\n    &lt;h1 class=\"mb-3\"&gt;JavaScript\u3067\u9332\u97f3\u3059\u308b\u30b5\u30f3\u30d7\u30eb&lt;\/h1&gt;\r\n    &lt;div id=\"app\"&gt;\r\n        <strong>&lt;!-- \u2462 \u9332\u97f3\u306e\u958b\u59cb\uff0f\u7d42\u4e86\u30dc\u30bf\u30f3\u3092\u8a2d\u7f6e\u3059\u308b\u90e8\u5206 --&gt;<\/strong>\r\n    &lt;\/div&gt;\r\n    &lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/vue@2.6.0\"&gt;&lt;\/script&gt;\r\n    &lt;script&gt;\r\n\r\n        new Vue({\r\n            el: '#app',\r\n            data: {\r\n\r\n                <strong>\/\/ \u2460 \u5909\u6570\u3092\u5ba3\u8a00\u3059\u308b\u90e8\u5206<\/strong>\r\n\r\n            },\r\n            methods: {\r\n\r\n                <strong>\/\/ \u2461 \u9332\u97f3\u3092\u958b\u59cb\uff0f\u30b9\u30c8\u30c3\u30d7\u3059\u308b\u90e8\u5206<\/strong>\r\n\r\n                <strong>\/\/ \u2463 \u97f3\u58f0\u30d5\u30a1\u30a4\u30eb\u306e\u62e1\u5f35\u5b50\u3092\u53d6\u5f97\u3059\u308b\u90e8\u5206<\/strong>\r\n\r\n            },\r\n            mounted() {\r\n\r\n                <strong>\/\/ \u2464 \u30de\u30a4\u30af\u306b\u30a2\u30af\u30bb\u30b9<\/strong>\r\n\r\n            }\r\n        });\r\n\r\n    &lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>\u3067\u306f\u5b9f\u969b\u306b\u3084\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\uff01<\/p>\n<h2>\u5909\u6570\u3092\u5ba3\u8a00\u3059\u308b\u90e8\u5206\u3000\u30fb\u30fb\u30fb\u3000\u2460<\/h2>\n<p>\u3053\u308c\u304b\u3089\u3044\u304f\u3064\u304b\u30e1\u30bd\u30c3\u30c9\u306a\u3069\u3092\u4f5c\u3063\u3066\u3044\u304d\u307e\u3059\u304c\u3001\u305d\u306e\u969b\u306b\u5fc5\u8981\u3068\u306a\u3063\u3066\u304f\u308b\u5909\u6570\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5b9a\u7fa9\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre>\/\/ \u2460 \u5909\u6570\u3092\u5ba3\u8a00\u3059\u308b\u90e8\u5206\r\n<strong>status: 'init',     \/\/ \u72b6\u6cc1<\/strong>\r\n<strong>recorder: null,     \/\/ \u97f3\u58f0\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b \"MediaRecorder\" \u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9<\/strong>\r\n<strong>audioData: [],      \/\/ \u5165\u529b\u3055\u308c\u305f\u97f3\u58f0\u30c7\u30fc\u30bf<\/strong>\r\n<strong>audioExtension: ''  \/\/ \u97f3\u58f0\u30d5\u30a1\u30a4\u30eb\u306e\u62e1\u5f35\u5b50<\/strong><\/pre>\n<p>\u307e\u305a<code>status<\/code>\u306f\u3001\u305d\u306e\u30da\u30fc\u30b8\u306e\u72b6\u6cc1\u304c\u308f\u304b\u308b\u3088\u3046\u3001\u4ee5\u4e0b\uff13\u3064\u306e\u6587\u5b57\u5217\u304c\u4fdd\u6301\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<ul>\n<li>init\u3000\u30fb\u30fb\u30fb\u3000\u30da\u30fc\u30b8\u304c\u8aad\u307f\u8fbc\u307e\u308c\u305f\u3070\u304b\u308a<\/li>\n<li>ready\u3000\u30fb\u30fb\u30fb\u3000\u9332\u97f3\u304c\u958b\u59cb\u3067\u304d\u308b\u72b6\u614b<\/li>\n<li>recording\u3000\u30fb\u30fb\u30fb\u3000\u9332\u97f3\u4e2d<\/li>\n<\/ul>\n<p>\u6b21\u306b<code>recorder<\/code>\u3068<code>audioData<\/code>\u3067\u3059\u304c\u3001\u624b\u9806\u3068\u3057\u3066\u306f<code>recorder<\/code>\u3092\u901a\u3057\u3066\u97f3\u58f0\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u3066<code>audioData<\/code>\u306b\u683c\u7d0d\u3001\u305d\u3057\u3066\u305d\u306e\u30c7\u30fc\u30bf\u3092\u52a0\u5de5\u3057\u3066\u30d5\u30a1\u30a4\u30eb\u4fdd\u5b58\u3059\u308b\u3068\u3044\u3046\u6d41\u308c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u6700\u5f8c\u306b<code>audioExtension<\/code>\u3067\u3059\u304c\u3001\u3053\u308c\u306f\u97f3\u58f0\u30d5\u30a1\u30a4\u30eb\u306e\u62e1\u5f35\u3092\u81ea\u52d5\u62bd\u51fa\u3057\u4fdd\u6301\u3057\u3066\u304a\u304f\u305f\u3081\u306e\u5909\u6570\u3067\u3059\u3002\u3068\u3044\u3046\u306e\u3082\u3001<code>Google Chrome<\/code>\u306e\u97f3\u58f0\u30d5\u30a1\u30a4\u30eb\u5f62\u5f0f\u306f<code>webm<\/code>\u3067\u3059\u304c\u3001<code>firefox<\/code>\u306e\u5834\u5408\u306f<code>ogg<\/code>\u3068\u306a\u3063\u3066\u3044\u308b\u305f\u3081\u3067\u3059\u3002<\/p>\n<h2>\u9332\u97f3\u3092\u958b\u59cb\uff0f\u30b9\u30c8\u30c3\u30d7\u3059\u308b\u90e8\u5206\u3000\u30fb\u30fb\u30fb\u3000\u2461<\/h2>\n<p>\u7d9a\u3044\u3066\u5b9f\u969b\u306b\u9332\u97f3\u3092\u958b\u59cb\uff06\u30b9\u30c8\u30c3\u30d7\u3059\u308b\u90e8\u5206\uff08\u30e1\u30bd\u30c3\u30c9\uff09\u3067\u3059\u3002<\/p>\n<pre><strong>startRecording() {<\/strong>\r\n\r\n<strong>    this.status = 'recording';<\/strong>\r\n<strong>    this.audioData = [];<\/strong>\r\n<strong>    this.recorder.start();<\/strong>\r\n\r\n<strong>},<\/strong>\r\n<strong>stopRecording() {<\/strong>\r\n\r\n<strong>    this.recorder.stop();<\/strong>\r\n<strong>    this.status = 'ready';<\/strong>\r\n\r\n<strong>},<\/strong><\/pre>\n<p><code>recorder<\/code>\u306f<code>MediaRecorder<\/code>\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3067\u3059\u304c\u3001\u3053\u308c\u306f\u5f8c\u307b\u3069<code>mounted()<\/code>\u306e\u4e2d\u3067\u5b9a\u7fa9\u3059\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001<code>recorder<\/code>\u306f\u30b7\u30f3\u30d7\u30eb\u306b<code>start()<\/code>\u3068<code>stop()<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u3067\u9332\u97f3\u3092\u958b\u59cb\uff0f\u7d42\u4e86\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u306a\u304a\u3001<code>startRecording()<\/code>\u3067\u306f<code>audioData<\/code>\u3092\u521d\u671f\u5316\u3057\u3066\u3044\u3066\u3001\u3055\u3089\u306b\u305d\u308c\u305e\u308c\u306e\u30e1\u30bd\u30c3\u30c9\u5185\u3067<code>status<\/code>\u3092\u5207\u308a\u66ff\u3048\u3066\u3044\u308b\u3053\u3068\u306b\u6ce8\u76ee\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u306e<code>status<\/code>\u306e\u5024\u306f\u3001\u6b21\u306e\u9805\u76ee\u3067\u4f7f\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u9332\u97f3\u306e\u958b\u59cb\uff0f\u7d42\u4e86\u30dc\u30bf\u30f3\u3092\u8a2d\u7f6e\u3059\u308b\u90e8\u5206\u3000\u30fb\u30fb\u30fb\u3000\u2462<\/h2>\n<p>\u6b21\u306b\u5b9f\u969b\u306b\u30d6\u30e9\u30a6\u30b6\u8868\u793a\u3055\u308c\u308b\u9332\u97f3\u306e\u958b\u59cb\uff06\u7d42\u4e86\u30dc\u30bf\u30f3\u3067\u3059\u3002<\/p>\n<pre>&lt;button class=\"btn btn-danger\" type=\"button\" <strong>v-if=\"status=='ready'\"<\/strong> <strong>@click=\"startRecording\"<\/strong>&gt;\u9332\u97f3\u3092\u958b\u59cb\u3059\u308b&lt;\/button&gt;\r\n&lt;button class=\"btn btn-primary\" type=\"button\" <strong>v-if=\"status=='recording'\"<\/strong> <strong>@click=\"stopRecording\"<\/strong>&gt;\u9332\u97f3\u3092\u7d42\u4e86\u3059\u308b&lt;\/button&gt;<\/pre>\n<p>\u3053\u3053\u3067\u91cd\u8981\u306a\u306e\u304c\u3001<code>v-if<\/code>\u306e\u90e8\u5206\u3067\u3059\u3002\u3053\u308c\u306f\u5909\u6570<code>status<\/code>\u304c\u5909\u5316\u3057\u305f\u3068\u304d\u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u306b\u30dc\u30bf\u30f3\u3092\u8868\u793a\uff0f\u975e\u8868\u793a\u3059\u308b\u305f\u3081\u3067\u3059\u3002<\/p>\n<ul>\n<li>ready\u3000\u30fb\u30fb\u30fb\u3000\u300c\u9332\u97f3\u3092\u958b\u59cb\u3059\u308b\u300d\u30dc\u30bf\u30f3\u3092\u8868\u793a<\/li>\n<li>recording\u3000\u30fb\u30fb\u30fb\u3000\u300c\u9332\u97f3\u3092\u7d42\u4e86\u3059\u308b\u300d\u30dc\u30bf\u30f3\u3092\u8868\u793a<\/li>\n<\/ul>\n<p>\u305d\u3057\u3066\u3001\u305d\u308c\u305e\u308c\u306e\u30af\u30ea\u30c3\u30af\u30a4\u30d9\u30f3\u30c8\u3067\u5148\u307b\u3069\u3064\u304f\u3063\u305f<code>startRecording()<\/code>\u3068<code>stopRecording()<\/code>\u3092\u5b9f\u884c\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>\u97f3\u58f0\u30d5\u30a1\u30a4\u30eb\u306e\u62e1\u5f35\u5b50\u3092\u53d6\u5f97\u3059\u308b\u90e8\u5206\u3000\u30fb\u30fb\u30fb\u3000\u2463<\/h2>\n<p>\u7d9a\u3044\u3066\u2460\u306e\u4f5c\u696d\u3067\u3064\u304f\u3063\u305f\u5909\u6570<code>audioExtension<\/code>\u306b\u683c\u7d0d\u3059\u308b\u3053\u3068\u306b\u306a\u308b\u300c\u97f3\u58f0\u30d5\u30a1\u30a4\u30eb\u306e\u62e1\u5f35\u5b50\u300d\u3092\u53d6\u5f97\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u3092\u3064\u304f\u3063\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002\uff08\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u306f\u6b21\u306e\u9805\u76ee\u3067\u4f7f\u3044\u307e\u3059\uff09<\/p>\n<pre><strong>getExtension(audioType) {<\/strong>\r\n\r\n<strong>    let extension = 'wav';<\/strong>\r\n<strong>    const matches = audioType.match(\/audio\\\/([^;]+)\/);<\/strong>\r\n\r\n<strong>    if(matches) {<\/strong>\r\n\r\n<strong>        extension = matches[1];<\/strong>\r\n\r\n<strong>    }<\/strong>\r\n\r\n<strong>    return '.'+ extension;<\/strong>\r\n\r\n<strong>}<\/strong><\/pre>\n<p>\u97f3\u58f0\u30d5\u30a1\u30a4\u30eb\u306e\u5f62\u5f0f\u306f\u3001<code>recorder<\/code>\u304b\u3089\u53d6\u5f97\u3067\u304d\u308b\u306e\u3067\u3059\u304c\u3001\u4e2d\u8eab\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u3082\u306e\u306b\u306a\u3063\u3066\u3044\u308b\u305f\u3081\u3001\u6b63\u898f\u8868\u73fe\u3067\u5fc5\u8981\u306a\u90e8\u5206\u3092\u5207\u308a\u51fa\u3057\u3066\u62e1\u5f35\u5b50\u3068\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre><strong>audio\/webm;codecs=opus<\/strong><\/pre>\n<h2>\u30de\u30a4\u30af\u306b\u30a2\u30af\u30bb\u30b9\u3000\u30fb\u30fb\u30fb\u3000\u2464<\/h2>\n<p>\u3067\u306f\u3001\u6700\u5f8c\u306b\u4eca\u56de\u3067\u4e00\u756a\u91cd\u8981\u306a\u90e8\u5206\u3067\u3059\u3002<\/p>\n<pre><strong>navigator.mediaDevices.getUserMedia({ audio: true })<\/strong>\r\n    .then(stream =&gt; {\r\n\r\n        <strong>this.recorder = new MediaRecorder(stream);\r\n        this.recorder.addEventListener('dataavailable', e =&gt; {\r\n\r\n            this.audioData.push(e.data);\r\n            this.audioExtension = this.getExtension(e.data.type);\r\n\r\n        });\r\n        this.recorder.addEventListener('stop', () =&gt; {\r\n\r\n            const audioBlob = new Blob(this.audioData);\r\n            const url = URL.createObjectURL(audioBlob);\r\n            let a = document.createElement('a');\r\n            a.href = url;\r\n            a.download = Math.floor(Date.now() \/ 1000) + this.audioExtension;\r\n            document.body.appendChild(a);\r\n            a.click();\r\n\r\n        });\r\n        this.status = 'ready';<\/strong>\r\n\r\n    });<\/pre>\n<p>\u3053\u306e\u4e2d\u3067\u306f\u307e\u305a\u6700\u521d\u306b\u4ee5\u4e0b\u306e\u90e8\u5206\u3067\u30de\u30a4\u30af\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u51e6\u7406\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre><strong>navigator.mediaDevices.getUserMedia({ audio: true })<\/strong><\/pre>\n<p>\u203b \u3053\u3053\u3067\u3001\u3082\u3057\u30d6\u30e9\u30a6\u30b6\u306b\u30de\u30a4\u30af\u3078\u306e\u30a2\u30af\u30bb\u30b9\u304c\u307e\u3060\u8a31\u53ef\u3055\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u304c\u8868\u793a\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5354\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/12\/record_audio_1.png\" alt=\"\" width=\"315\" height=\"131\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/12\/record_audio_1.png 315w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/12\/record_audio_1-300x125.png 300w\" sizes=\"auto, (max-width: 315px) 100vw, 315px\" \/><\/p>\n<p>\u305d\u3057\u3066\u3001\u8a31\u53ef\u3055\u308c\u308b\u3068<code>then()<\/code>\u306e\u4e2d\u8eab\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u4e2d\u3067\u306f\u3001\u53d6\u5f97\u3055\u308c\u305f<code>stream<\/code>\u3092\u4f7f\u3063\u3066<code>MediaRecorder<\/code>\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u308a\u3001\u5909\u6570<code>recorder<\/code>\u3068\u3057\u3066\u4fdd\u6301\u3057\u307e\u3059\u3002<\/p>\n<p>\u3055\u3089\u306b\u3001\u305d\u306e<code>recorder<\/code>\u306b\u306f\uff12\u3064\u306e\u30a4\u30d9\u30f3\u30c8\u3092\u3064\u3051\u307e\u3059\u3002<\/p>\n<p>\uff11\u3064\u3081\u304c\u3001<code>dataavailable<\/code>\u3067\u3001\u3053\u3053\u3067\u306f\u97f3\u58f0\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u3001\u3055\u3089\u306b\u305d\u308c\u3092\u5909\u6570<code>audioData<\/code>\u306b\u683c\u7d0d\u3057\u3066\u3044\u307e\u3059\u3002\u307e\u305f\u3001\u97f3\u58f0\u30d5\u30a1\u30a4\u30eb\u306e\u62e1\u5f35\u5b50\u3082\u540c\u3058\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u53d6\u5f97\u3059\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u3082\u3046\u4e00\u3064\u306e\u30a4\u30d9\u30f3\u30c8\u304c<code>stop<\/code>\u3067\u6587\u5b57\u901a\u308a\u9332\u97f3\u304c\u7d42\u4e86\u3057\u305f\u3068\u304d\u306b\u5b9f\u884c\u3055\u308c\u308b\u30a4\u30d9\u30f3\u30c8\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u4e2d\u3067\u306f\u97f3\u58f0\u30c7\u30fc\u30bf\u3092<code>Blob<\/code>\u5316\u3057\u3001<code>&lt;a download=\"***\"&gt;<\/code>\u30bf\u30b0\u306e<code>href<\/code>\u3068\u3057\u3066\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002\u305d\u3057\u3066\u3053\u306e<code>&lt;a&gt;<\/code>\u30bf\u30b0\u306f\u30da\u30fc\u30b8\u306b\u8ffd\u52a0\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u3001<code>click()<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u3067\u300c\u30af\u30ea\u30c3\u30af\u3057\u305f\u3053\u3068\u300d\u306b\u306a\u308a\u3001\u30d5\u30a1\u30a4\u30eb\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3092\u5b9f\u73fe\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h1>\u30c6\u30b9\u30c8\u3057\u3066\u307f\u308b<\/h1>\n<p>\u77ed\u3044\u3067\u3059\u304c\u3001\u5b9f\u969b\u306b\u300c\u30a8\u30ea\u30fc\u30bc\u306e\u305f\u3081\u306b\u300d\u306e\u5192\u982d\u90e8\u5206\u3092\u30b9\u30de\u30db\u306e\u30a2\u30d7\u30ea\u3067\u6f14\u594f\u3057\u305f\u3082\u306e\u304c\u4ee5\u4e0b\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u203b <code>webm<\/code>\u5f62\u5f0f\u3067\u3059\u306e\u3067\u30d6\u30e9\u30a6\u30b6\u306b\u3088\u3063\u3066\u306f\u518d\u751f\u3067\u304d\u306a\u3044\u306e\u3067\u3054\u6ce8\u610f\u304f\u3060\u3055\u3044\u3002<\/p>\n<div style=\"width: 525px;\" class=\"wp-video\"><!--[if lt IE 9]><script>document.createElement('video');<\/script><![endif]-->\n<video class=\"wp-video-shortcode\" id=\"video-5351-1\" width=\"525\" height=\"295\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/webm\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/12\/1576518967.webm?_=1\" \/><a href=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/12\/1576518967.webm\">https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/12\/1576518967.webm<\/a><\/video><\/div>\n<h1>\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b<\/h1>\n<p>\u4eca\u56de\u958b\u767a\u3057\u305f\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u4ee5\u4e0b\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u306a\u304a\u3001<code>base.html<\/code>\u306f\u57fa\u672c\u30b3\u30fc\u30c9\u3067\u3001<code>complete.html<\/code>\u304c\u5b8c\u6210\u7248\u306e\u30b3\u30fc\u30c9\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<a  data-e-Disable-Page-Transition=\"true\" class=\"download-link\" title=\"\" href=\"https:\/\/blog.capilano-fw.com?download=5357&amp;tmstv=1777537977\" rel=\"nofollow\" id=\"download-link-5357\" data-redirect=\"false\" >\n\t\u30d6\u30e9\u30a6\u30b6\u3067\u9332\u97f3\uff06\u30d5\u30a1\u30a4\u30eb\u4fdd\u5b58\u3059\u308b<\/a>\n\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f\u30d6\u30e9\u30a6\u30b6\u3060\u3051\u3067\u9332\u97f3\uff06\u30d5\u30a1\u30a4\u30eb\u4fdd\u5b58\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u6700\u8fd1\u306f\u30d6\u30e9\u30a6\u30b6\u3068\u306f\u3044\u3048\u3069\u3082\u3001\u30cd\u30a4\u30c6\u30a3\u30d6\u30a2\u30d7\u30ea\u306e\u3088\u3046\u306a\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u304d\u3066\u3044\u308b\u306e\u3067\u3001\u6211\u3005\u30a6\u30a7\u30d6\u958b\u767a\u3092\u3059\u308b\u4eba\u9593\u304b\u3089\u3059\u308b\u3068\u30ef\u30af\u30ef\u30af\u3059\u308b\u3053\u3068\u304c\u591a\u304f\u306a\u3063\u3066\u3044\u307e\u3059\uff08\u7b11\uff09<\/p>\n<p>\u3053\u306e\u6a5f\u80fd\u3092\u5fdc\u7528\u3059\u308b\u3068\u3001\u52d5\u753b\u306b\u58f0\u3092\u5439\u304d\u8fbc\u3080\u6a5f\u80fd\u306a\u3069\u3082\u3064\u304f\u308c\u308b\u3088\u3046\u306b\u306a\u308b\u3068\u601d\u3046\u306e\u3067\u3001\u305c\u3072\u307f\u306a\u3055\u3093\u306e\u30b5\u30a4\u30c8\u3067\u3082\u6d3b\u7528\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u306d\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\uff01<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3467 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_9.png\" alt=\"\" width=\"216\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_9.png 216w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_9-203x300.png 203w\" sizes=\"auto, (max-width: 216px) 100vw, 216px\" \/>\u300c\u6c17\u304c\u3064\u3051\u3070\u3082\u3046\u5e74\u672b\u304b\u30fb\u30fb\u30fb\u30db\u30f3\u30c8\u65e9\u3044\ud83d\ude02\u300d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u524d\u3005\u56de\u3001\u610f\u5916\u3068\u7c21\u5358\uff01\u97f3\u3092\u611f\u77e5\u3057\u3066\u9332\u753b\u3059\u308b\u76e3\u8996\u30ab\u30e1\u30e9\u3092\u3064\u304f\u308b\u3067\u306f\u3001Python\u3067\u5927\u304d\u306a\u97f3\u3092\u611f\u77e5\u3057\u3066\u9332\u753b\u3059\u308b\u3068\u3044\u3046\u6a5f\u80fd\u3092\u3064\u304f\u3063\u3066\u307f\u307e\u3057\u305f\u3002 \u3061\u306a\u307f\u306b\u306a\u305cP &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=5351\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;JavaScript\u3060\u3051\uff01\u30d6\u30e9\u30a6\u30b6\u3067\u9332\u97f3\uff06\u30d5\u30a1\u30a4\u30eb\u4fdd\u5b58\u3059\u308b\u65b9\u6cd5&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":5364,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,12,97],"tags":[196],"class_list":["post-5351","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","category-vue-js","category-97","tag-196"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/5351","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5351"}],"version-history":[{"count":6,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/5351\/revisions"}],"predecessor-version":[{"id":5362,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/5351\/revisions\/5362"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/5364"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5351"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5351"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5351"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}