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 branches found
No related tags found
No related merge requests found
...@@ -62,6 +62,15 @@ ...@@ -62,6 +62,15 @@
</div> </div>
{{/if}} {{/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}} {{#if fields}}
<div class="attachment-fields"> <div class="attachment-fields">
{{#each fields}} {{#each fields}}
......
...@@ -87,19 +87,31 @@ readAsArrayBuffer = (file, callback) -> ...@@ -87,19 +87,31 @@ readAsArrayBuffer = (file, callback) ->
onComplete: (file) -> onComplete: (file) ->
self = this self = this
url = file.url.replace(Meteor.absoluteUrl(), '/') 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() _id: Random.id()
rid: roomId rid: roomId
msg: "" msg: ""
file: file:
_id: file._id _id: file._id
groupable: false groupable: false
attachments: [{ attachments: [attachment]
image_url: url
title: "File Uploaded: #{file.name}" Meteor.call 'sendMessage', msg, ->
title_link: url
}]
}, ->
Meteor.setTimeout -> Meteor.setTimeout ->
uploading = Session.get 'uploading' uploading = Session.get 'uploading'
if 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