]> cat aescling's git repositories - mastodon.git/commitdiff
[Glitch] Fix new audio player features not working on Safari
authorThibG <thib@sitedethib.com>
Sun, 2 Aug 2020 09:20:17 +0000 (11:20 +0200)
committerThibaut Girka <thib@sitedethib.com>
Sun, 2 Aug 2020 12:35:40 +0000 (14:35 +0200)
Port 51b5bb53015df5b360f0e366f7fc67dce75e2d6c to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
app/javascript/flavours/glitch/features/audio/index.js

index 4e85e3c58184ad0e1508021882c4529b8a782720..33e67fcbe38c19fa23499ed3fb35baae746d4f28 100644 (file)
@@ -254,8 +254,9 @@ class Audio extends React.PureComponent {
   }
 
   _initAudioContext () {
-    const context  = new AudioContext();
-    const source   = context.createMediaElementSource(this.audio);
+    const AudioContext = window.AudioContext || window.webkitAudioContext;
+    const context      = new AudioContext();
+    const source       = context.createMediaElementSource(this.audio);
 
     this.visualizer.setAudioContext(context, source);
     source.connect(context.destination);