Can I make ionic 3 music app that plays mp3 files stored locally on the device?
Of course yes.
You can use
- Ionic Native File: to get local files. https://ionicframework.com/docs/native/file/
- Ionic Native Music Controls: to display a ‘media’ notification with play/pause, previous, next buttons, allowing the user to control the play. Handle also headset event (plug, unplug, headset button). https://ionicframework.com/docs/native/music-controls/
- And some module like Angular 2 Music Player to design your app player https://github.com/NathanWalker/ngTunes
Or Learn to design your own player https://scotch.io/tutorials/build-a-music-player-with-angular-2-electron-i-setup-basics-concepts
Or http://angularscript.com/audio-player-angular-2-ionic-2/
3 Likes
Would you please provide example code for it?
1 Like
import { File } from '@ionic-native/file';
constructor(private file: File) { }
...
this.file.checkDir(this.file.dataDirectory, 'mydir').then(_ => console.log('Directory exists')).catch(err => console.log('Directory doesnt exist'));
In above code, what specific path we have to put instead of ‘mydir’?
Explain to me as detailed as possible.
1 Like
Whatever directory/path that you’re trying to access.
As I make and run the app in browser or simulator it will only access the project folder. I want to run it on a real device and want to access local mp3 files stored in the device.
Hi, Music Controls has stopped to work on iOS11