From f5c7779d33e2064ba69a98f8ef1f2c4c60118d51 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sun, 5 Jul 2015 03:00:19 -0700 Subject: [PATCH] Support Vocaroo/Clyp embedding on Safari. --- src/Linkification/Embedding.coffee | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Linkification/Embedding.coffee b/src/Linkification/Embedding.coffee index 39fdc13fd..c00836ce3 100644 --- a/src/Linkification/Embedding.coffee +++ b/src/Linkification/Embedding.coffee @@ -277,10 +277,12 @@ Embedding = regExp: /^\w+:\/\/(?:www\.)?vocaroo\.com\/i\/(\w+)/ style: '' el: (a) -> - $.el 'audio', + el = $.el 'audio', controls: true preload: 'auto' - src: "http://vocaroo.com/media_command.php?media=#{a.dataset.uid}&command=download_ogg" + type = if el.canPlayType 'audio/ogg' then 'ogg' else 'mp3' + el.src = "http://vocaroo.com/media_command.php?media=#{a.dataset.uid}&command=download_#{type}" + el , key: 'Vimeo' regExp: /^\w+:\/\/(?:www\.)?vimeo\.com\/(\d+)/ @@ -360,10 +362,12 @@ Embedding = regExp: /^\w+:\/\/(?:www\.)?clyp\.it\/(\w+)/ style: '' el: (a) -> - $.el 'audio', + el = $.el 'audio', controls: true preload: 'auto' - src: "http://clyp.it/#{a.dataset.uid}.ogg" + type = if el.canPlayType 'audio/ogg' then 'ogg' else 'mp3' + el.src = "http://clyp.it/#{a.dataset.uid}.#{type}" + el , # dummy entries: not implemented but included to prevent them being wrongly embedded as a subsequent type key: 'Loopvid-dummy'