inway / flutter_ringtone_player

Simple Flutter plugin to play ringtone, alarm & notification sounds
MIT License
89 stars 57 forks source link

'fromFile' not working #70

Open Ajai-Joseph opened 6 months ago

Ajai-Joseph commented 6 months ago

I have stored an audio file in app's document directory (getting the path with 'getApplicationDocumentsDirectory()').

When I tried to play this audio from this path, i am getting the exception: "Please specify the sound source." the filePath is like, '/data/user/0/......../app_flutter/alarm_sound.mp3'

try { await FlutterRingtonePlayer().play( fromFile: filePath ); } catch (e) { log(e.toString()); }

When I tried to play from assets using 'fromAsset', its working, but can't play this file which is stored in the app

SPodjasek commented 5 months ago

Can you please paste the exact error message being thrown?

FlorianAlt commented 5 months ago

Same issue here:

FlutterRingtonePlayer().play(fromFile: filePath);

results in

Please specify the sound source.

It is caused by if (fromAsset == null && android == null && ios == null) { throw "Please specify the sound source."; }

in flutter_ringtone_player/flutter_ringtone_player_method_channel.dart Version flutter_ringtone_player: ^4.0.0+2