[HELP] Audio Player - player is not set
See original GitHub issueI 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:
- Created 3 years ago
- Comments:10
Top GitHub Comments
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.
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