How to get audio files on my phone using Ionic 2 Cordova plugins?

前端 未结 1 1460
花落未央
花落未央 2021-01-27 13:49

I have tried the Ionic mediaPlugin

import { MediaPlugin } from \'ionic-native\';

var file = new MediaPlugin(\'path/to/file.mp3\');

I\'m still

1条回答
  •  被撕碎了的回忆
    2021-01-27 14:40

    Check this tutorial first it will guide you. However check this too, it will tell you where you have to store your data.

    If you do it on android, you should use externalDataDirectory.

      this.filePath = cordova.file.externalDataDirectory;
    
      this.mediaPlugin = new MediaPlugin(this.filePath + this.directoryName + "/" + this.actualAudioFileName);
    

    After this you can find your data under the following folder on your phone Android/data/yourApplicationId/files/yourDirectoryName

    0 讨论(0)
提交回复
热议问题