diff --git a/src/Linkification/Linkify.coffee b/src/Linkification/Linkify.coffee
index a00466fa3..7ede416af 100755
--- a/src/Linkification/Linkify.coffee
+++ b/src/Linkification/Linkify.coffee
@@ -303,7 +303,7 @@ Linkify =
{status} = @
return el.textContent = "ERROR #{status}" unless status in [200, 304]
{files} = @response
- for type in ['video/mp4', 'video/ogv', 'image/svg+xml', 'image/png', 'image/gif', 'image/jpeg', 'image/svg', 'audio/mpeg']
+ for type in ['video/mp4', 'video/webm', 'video/ogv', 'image/svg+xml', 'image/png', 'image/gif', 'image/jpeg', 'audio/mpeg', 'audio/ogg']
for file in files
if file.type is type
embed = file
@@ -311,17 +311,18 @@ Linkify =
break if embed
return div.textContent = "ERROR: Not a valid filetype" unless embed
switch embed.type
- when 'video/mp4', 'video/ogv'
- el.innerHTML = ''
- el.firstChild.children[0].src = "https://mediacru.sh/#{a.dataset.uid}.mp4"
- el.firstChild.children[1].src = "https://mediacru.sh/#{a.dataset.uid}.ogv"
- when 'image/png', 'image/gif', 'image/jpeg', 'image/svg', 'image/svg+xml'
+ when 'video/mp4', 'video/webm', 'video/ogv'
+ el.innerHTML = ''
+ for ext, i in ['mp4', 'webm', 'ogv']
+ el.firstChild.children[i].src = "https://mediacru.sh/#{a.dataset.uid}.#{ext}"
+ when 'image/svg+xml', 'image/png', 'image/gif', 'image/jpeg'
el.innerHTML = '
'
el.firstChild.href = a.dataset.href
el.firstChild.firstChild.src = "https://mediacru.sh/#{file.file}"
- when 'audio/mpeg'
- el.innerHTML = ''
- el.firstChild.firstChild.src = "https://mediacru.sh/#{file.file}"
+ when 'audio/mpeg', 'audio/ogg'
+ el.innerHTML = ''
+ for ext, i in ['mp3', 'ogg']
+ el.firstChild.children[i].src = "https://mediacru.sh/#{a.dataset.uid}.#{ext}"
else
el.textContent = "ERROR: No valid filetype."
el