Tau: [BUG]:Player with url not work on IOS

Created on 11 Feb 2021  路  2Comments  路  Source: Canardoux/tau

Flutter Sound Version : 7.5.3+1

  • FULL or LITE flavor ? Full

  • Important: Result of the command : flutter pub deps | grep flutter_sound

$ flutter pub deps | grep flutter_sound
|-- flutter_sound 7.5.3+1
|   |-- flutter_sound_platform_interface 7.5.3+1
|   |-- flutter_sound_web 7.5.3+1
|   |   |-- 

Platforms you faced the error: IOS

Hi, first of all, thank you for a nice package I use this package for record sound and send them to server-side and then play them on another screen. the problem is on the playback screen on ios it not start playing (on android everything works fine)

on playback screen I have this :

  Future<void> play(String path, Function onEnd) async {
    assert(_mPlayerIsInited && _mPlayer.isStopped);
    await _mPlayer.startPlayer(
      fromURI: path,
      codec: Codec.aacADTS,
      whenFinished: () {
        onEnd();
      },
    );

    setState(() {});
  }

and it's how I use it :

Future<void> _showSoundPereviewDialog(String soudPath) {
    return showDialog<void>(
      context: context,
      barrierDismissible: false, // user must tap button!
      builder: (BuildContext context) {
        bool isPlay = _mPlayer.isPlaying;
        return StatefulBuilder(builder: (context, setState) {
          return AlertDialog(
            backgroundColor: Colors.white,
            content: SingleChildScrollView(
              child: ListBody(
                children: <Widget>[
                  Text(
                    translate.tr("listen-voice"),
                    style: kLabelStylePersian.copyWith(color: Colors.black),
                  ),
                  SizedBox(
                    height: 10,
                  ),
                  RaisedButton(
                    onPressed: () {
                      if (!isPlay) {
                        play(soudPath, () {
                          setState(() {
                            isPlay = false;
                          });
                        }).then((_) {
                          setState(() {
                            isPlay = true;
                          });
                        });
                      } else {
                        _stopPlayer().then((value) => setState(() {
                              isPlay = false;
                            }));
                      }
                    },
                    color: Colors.white,
                    disabledColor: Colors.grey,
                    child: Text(
                      isPlay ? translate.tr("stop") : translate.tr("play"),
                      style: kLabelStylePersian,
                    ),
                  ),
                ],
              ),
            ),
            actions: <Widget>[
              TextButton(
                child: Text(
                  translate.tr("visit-list-download-button"),
                  style:
                      kLabelStylePersianBold.copyWith(color: kLightBlueColor),
                ),
                onPressed: () async {
                  await launch(soudPath);
                },
              ),
              TextButton(
                child: Text(
                  translate.tr("close"),
                  style:
                      kLabelStylePersianBold.copyWith(color: kLightBlueColor),
                ),
                onPressed: () {
                  _stopPlayer().then((value) => Navigator.of(context).pop());
                },
              ),
            ],
          );
        });
      },
    );
  }

and log on the console :

flutter: FS:---> startPlayer
flutter: FS:---> stop
IOS:--> stopPlayer
IOS:<-- stopPlayer - status = 0
flutter: FS:<--- stop
flutter: FS:---> _convert
flutter: FS:---> needToConvert
flutter: FS:<--- needToConvert
flutter: FS:<--- _convert
IOS:--> startPlayer
IOS:<-- startPlayer
flutter: FS:<--- startPlayer

I do the exact same thing on the previous screen when I record sound and play it as a file path but when I upload it to server and use URL it not work on IOS (on android work fine)

maybe bug Not yet handled

Most helpful comment

Thank you for the information.
I added something here.

All 2 comments

the problem was i must add this to info :

<key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>

didn't see it on document maybe add it

Thank you for the information.
I added something here.

Was this page helpful?
0 / 5 - 0 ratings