gdelataillade / alarm

A Flutter plugin to easily manage alarms on iOS and Android
https://pub.dev/packages/alarm
MIT License
132 stars 86 forks source link

When playing downloaded files locally on iOS, they do not play correctly if they are located in a directory deeper than the Documents directory. #143

Closed tattuu closed 9 months ago

tattuu commented 10 months ago

Alarm plugin version 3.0.6

Describe the bug When I set a downloaded file in a directory deeper than the Documents directory and try to play it, I get an error.

To Reproduce Steps to reproduce the behavior:

  1. Download audio files from the Internet
  2. Create a directory in the Documents directory and set the downloaded audio files in it.
    • ex: /xxx/yyy/zzz/Documents/temp/sample.mp3
  3. Execute AlarmSettings().
  4. It either stops with an error or does not sound when the time is up.

Expected behavior Files downloaded to directories deeper than the Documents directory are played back correctly.

Device info iPhone SE, iOS 15.8

Additional context This is due to the fact that the file was downloaded to a directory deeper than the Documents directory. If I put the file directly under the Documents directory, it plays fine.

And I believe that it is better to support deeper hierarchical directories, not just directly under the Documents directory.

I could be wrong, but I think lines 118-128 in alarm/ios/Classes/SwiftAlarmPlugin.swift are relevant.

gdelataillade commented 9 months ago

Hi @tattuu

I just released version 3.0.7 with a fix about your issue. Please let me know if it fixes it.

tattuu commented 9 months ago

Hi @gdelataillade

Thanks for responding so quickly!

I just tried to test it, but the https://github.com/gdelataillade/alarm/issues/146 error prevented me from doing so.

I will test as soon as the https://github.com/gdelataillade/alarm/issues/146 is fixed.

gdelataillade commented 9 months ago

Hi @tattuu

I fixed #146. Sorry for the inconvenience btw. You can upgrade package version to 3.0.8.

tattuu commented 9 months ago

Hi @gdelataillade

Don't worry about it.

I updated and checked and the audio played correctly!

Thanks!