Play encrypted mp3 file by direct encryption


#1

I am looking for ideas, i want to build a mp3 player in ionic 3 in which I should encrypt mp3 file using the encryption plugin present in ionic-native. and before the user to play the music, first the mp3 file should be decrypted and then played using the plugin audio of ionic-native . I didnt start the project but i am doing a feasibility study first. so the question is: Ionic can at the same time decrypt a file and read it? or it should decrypt first and store it somewhere (in tmp folder for example) and read it after. See the code to get my idea;

Thank you in advance

constructor(private media: Media, private fileEncryption: FileEncryption) {

     //creating the decrypted file    
     const decryptedFile = 
     this.fileEncryption.encrypt('assets/file/encryptedfile.mp3', 'secretKey');

     //creating the MediaObject
     const file: MediaObject = this.media.create(decryptedFile);

     //play the music
     file.play();
}