From 67aa79964ee6688740600ab897097280d031404e Mon Sep 17 00:00:00 2001 From: Yamagishi Kazutoshi Date: Wed, 10 May 2017 23:58:54 +0900 Subject: [PATCH] Add boop sounds in Vorbis format (#2963) Vorbis is audio format of Open Source. Can play audio in a free environment where you can not play mp3. --- app/javascript/mastodon/middleware/sounds.js | 22 ++++++++++++++++++- public/sounds/boop.ogg | Bin 0 -> 5164 bytes 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 public/sounds/boop.ogg diff --git a/app/javascript/mastodon/middleware/sounds.js b/app/javascript/mastodon/middleware/sounds.js index 200efa3d79..639214b149 100644 --- a/app/javascript/mastodon/middleware/sounds.js +++ b/app/javascript/mastodon/middleware/sounds.js @@ -1,3 +1,14 @@ +const createAudio = sources => { + const audio = new Audio(); + sources.forEach(({ type, src }) => { + const source = document.createElement('source'); + source.type = type; + source.src = src; + audio.appendChild(source); + }); + return audio; +} + const play = audio => { if (!audio.paused) { audio.pause(); @@ -9,7 +20,16 @@ const play = audio => { export default function soundsMiddleware() { const soundCache = { - boop: new Audio(['/sounds/boop.mp3']) + boop: createAudio([ + { + src: '/sounds/boop.ogg', + type: 'audio/ogg', + }, + { + src: '/sounds/boop.mp3', + type: 'audio/mpeg' + }, + ]), }; return ({ dispatch }) => next => (action) => { diff --git a/public/sounds/boop.ogg b/public/sounds/boop.ogg new file mode 100644 index 0000000000000000000000000000000000000000..a2124e1167d9c2c357d98238f89598f8295cbcdb GIT binary patch literal 5164 zcmahtdmxkR|IZjkJ2jVtR#C<#b*wf_DH}3lVZ1KWaxX$+*6HT77)eMPNffdomkyyg z)sc{Ha%m_;Np#ii(D|wSo=tVW-@m@kp7(t}@8|YB&*$x4Hub@V$k8T;C-F zi+mGb$!9j4wl=?8;>i0ECt(`SUW$MJD;P$s}czGnmwMb8Tk+qa9G3Rr3p^ zItT3BLbX_Fv1%pR%uL3<1YRNAgQ9{%Vyq!C2oh;>qJBhJ;H(@Z041kY#>f33@KR*%Q8a`wGL;Aa>V7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