diff --git a/src/main/coffeescript/view/OperationView.coffee b/src/main/coffeescript/view/OperationView.coffee index 908d0f39..69106e1d 100644 --- a/src/main/coffeescript/view/OperationView.coffee +++ b/src/main/coffeescript/view/OperationView.coffee @@ -337,6 +337,10 @@ class OperationView extends Backbone.View # if server is nice, and sends content-type back, we can use it contentType = if headers && headers["Content-Type"] then headers["Content-Type"].split(";")[0].trim() else null + + supportsAudioPlayback = (contentType) -> + audioElement = document.createElement('audio') + return !!(audioElement.canPlayType && audioElement.canPlayType(contentType).replace(/no/, '')) if !content code = $('').text("no content") @@ -352,6 +356,8 @@ class OperationView extends Backbone.View pre = $('
').append(code)
     else if /^image\//.test(contentType)
       pre = $('').attr('src',url)
+    else if /^audio\//.test(contentType) and supportsAudioPlayback(contentType)
+      pre = $('