Skip to content
Snippets Groups Projects
Commit 211c01ff authored by Rodrigo Nascimento's avatar Rodrigo Nascimento
Browse files

Render a player for audio files

parent 450fd3f2
No related merge requests found
......@@ -62,6 +62,15 @@
</div>
{{/if}}
{{#if audio_url}}
<div class="attachment-audio">
<audio controls>
<source src="{{fixCordova audio_url}}" type="{{audio_type}}">
Your browser does not support the audio element.
</audio>
</div>
{{/if}}
{{#if fields}}
<div class="attachment-fields">
{{#each fields}}
......
......@@ -87,19 +87,31 @@ readAsArrayBuffer = (file, callback) ->
onComplete: (file) ->
self = this
url = file.url.replace(Meteor.absoluteUrl(), '/')
Meteor.call 'sendMessage', {
attachment =
title: "File Uploaded: #{file.name}"
title_link: url
if /^image\/.+/.test file.type
attachment.image_url = url
attachment.image_type = file.type
attachment.image_size = file.size
if /^audio\/.+/.test file.type
attachment.audio_url = url
attachment.audio_type = file.type
attachment.audio_size = file.size
msg =
_id: Random.id()
rid: roomId
msg: ""
file:
_id: file._id
groupable: false
attachments: [{
image_url: url
title: "File Uploaded: #{file.name}"
title_link: url
}]
}, ->
attachments: [attachment]
Meteor.call 'sendMessage', msg, ->
Meteor.setTimeout ->
uploading = Session.get 'uploading'
if uploading?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment