question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[HELP] Audio Player - player is not set

See original GitHub issue

I need Help for :

  • Using the API ? Yes, I Play (a recorded audio) from local and remote

  • Generate an iOS or Android App ? Starting from iOS and wait Recording Opus OGG on android to extends also on Android devices

  • Debugging my App ? Not sure


Here is my question :

Hi guys, thanks a lot for this great job you are doing…

My app records Opus OGG files on iOS, send them to remote server, then play on another device.

I am correctly recording files on iOS and I am sure it works, because I tried with another client.

Unfortunately I have an issue while I am trying to reproduce the recorded audio from my app.

I did many tries including playing the remote file example, but it is not working.

I am facing this issue:

Debugging the code I am able to see the full message that is raised by:

flutter_sound_player.dart:649 Future<void> startPlayerFromTrack( Track track, … await lock.synchronized(() async { Raise: PlatformException(FAILED, startPlayerFromTrack(), null)

Then in message_codecs.dart:571 Error Code: Audio Player Error Message: player is not set

The code (snippets) are:

Called from page widget initialization

  _initSoundPlayer() async {
    await _soundPlayer.openAudioSessionWithUI(
        focus: AudioFocus.requestFocusTransient,
        category: SessionCategory.playAndRecord,
        mode: SessionMode.modeDefault,
        device: AudioDevice.speaker,
        audioFlags: outputToSpeaker | allowBlueTooth | allowHeadset);
    await _soundPlayer.setSubscriptionDuration(Duration(milliseconds: 10));
  }

Called from UI Tap

  _playMessage(P2TMessage message, Function whenFinished) async {

    var onError = (err) => print("Error playing track ${message.id}: $err");
    final track = await _getAudioTrack(message);

    try {
      print("Set Volume to 70%");
      _soundPlayer.setVolume(0.7);
      await _soundPlayer
          .startPlayerFromTrack(track, whenFinished: whenFinished)
          .catchError(onError);
    } catch (e) {
      print("Exception paying message id: ${message.id}");
      print(e);
    }
  }

I am not sure what to use between openAudioSessionWithUI or openAudioSession… In both case is not working… I also checked info.plist and I have this:

	<key>UIBackgroundModes</key>
	<array>
            <!-- ... -->
            <string>audio</string>
	</array>

Any idea?

Thanks a lot, Davide.

#Updates Local played file URI is: file:///var/mobile/Containers/Data/Application/${DEVICE_UUID}/Documents/audio/2020-09-04-12-09-35-689.ogg

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
molekola-iocommented, Sep 8, 2020

Ok Larpoux, it is working fine, we changed the server implementation and now is using Opus / OGG File, but I download the file locally before to play.

Thanks for your help.

Davide.

1reaction
molekola-iocommented, Sep 5, 2020

Davide,

Playing OPUS/OGG on iOS needs Flutter Sound FULL flavor. The LITE flavor will not work

Sure! I’m using the full version.

Now with your updates is working correctly using local file and data buffer, but not yet the remote file, I am still investigating on this…

Thanks, Dabide

Read more comments on GitHub >

github_iconTop Results From Across the Web

[HELP] Audio Player - player is not set · Issue #447
Yes, I Play (a recorded audio) from local and remote Generate an iOS or Android App ... [HELP] Audio Player - player is...
Read more >
Object for playing audio - MATLAB
Use an audioplayer object to play audio data. The audioplayer object contains properties that enable additional flexibility during playback.
Read more >
There is no sound when playing a DVD or audio CD.
Attempt to play a different disc in the DVD player. Try playing a different audio source through the television or receiver. Connect the...
Read more >
flutter audio player play sound not working in IOS
I run the code in real ios device and click the button. It suppose the play the mp3 file, but no sound at...
Read more >
Chromecast Audio is not listed or not set up
Chromecast Audio is not listed or not set up · Close and reopen the Google Home app. · Reboot the Chromecast Audio device....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found