回答編集履歴

1

その他のやり方

2017/06/12 02:57

投稿

m.ts10806
m.ts10806

スコア80850

test CHANGED
@@ -25,3 +25,23 @@
25
25
  [AudioContext - Web API インターフェイス | MDN](https://developer.mozilla.org/ja/docs/Web/API/AudioContext)
26
26
 
27
27
  safariでは「未サポート」となっている機能が見受けられます。Mobileは完全未サポートのようですね。
28
+
29
+
30
+
31
+ ひとまずエラーが出ないようにするにはこんな感じで回避
32
+
33
+ ```JavaScript
34
+
35
+ if(AudioContext || webkitAudioContext || mozAudioContext){
36
+
37
+ this.audioContext = new AudioContext || new webkitAudioContext || new mozAudioContext;
38
+
39
+ }else[
40
+
41
+ alert("お使いのブラウザには対応していません。");
42
+
43
+ }
44
+
45
+ ```
46
+
47
+ this.audioContext にはnullとか入れておいて使用している箇所の前で ```if(this.audioContext != null)```で更に回避しておく必要があります。