Publishing An ArrayBuffer ( Audio Recorded file ) using CollectionFS

#1

Hi,

I use the recoderAudio package

maxencecornet:audio-recorder


to record an ArrayBuffer audio file. Then i successfully save it using CollectionFS.

This way:

`var audioRecorder = new AudioRecorder();

Template.followerViewing.events({
	'click #listenIt': function( event ) {
	    event.preventDefault();
		speak();
	},
	'click #v_request': function(){
                
                audioRecorder.startRecording();

               

	},
	'click #v_stop': function(){
		
		 // audioRecorder.stopRecording('wav', 'wavFile');
		 audioRecorder.stopRecording('Uint8Array', 'ArrayBufferFile', function (error, result) {
    // result contains the audio file input Array buffer
    // Bert.alert('Yes!');
           console.log(result);
          var Uint8Array = new Blob([result]);
          var newFile = new FS.File();
          var userId = Meteor.userId;
             newFile.attachData(Uint8Array, {type: 'application/audio'});
             Images.insert(newFile)
});
	}
});
`

Now i am trying to publish it like this:


Meteor.publish('thisVoiceM', function(){
   var doc = FS.File(Images.find());   
    return doc;
})

Meteor.subscribe('thisVoiceM');
Template.followerViewing.helpers({
	'showVoiceM': function(){
        var doc = FS.File(Images.find());	
        return doc;
    }
});


<div class="container" id="senttts">
   
               {{#each showVoiceM}}
                  <div class="audio">
                      <audio src="{{this.url store='images'}}" alt=""  class= "thumbnail"</audio>
                     <source src="{{this.url store='images'}}" type="">

  
                 </div>
               {{/each}}
         
  </div>  

The problem is that, i cannot seem to make it works.

Please help me if there is any better way to get audio file and playing on sahring.

Thank you so much.

Love,