[B4X] Example Play Audio MP3 (b4a + b4i)

[B4X] Example Play Audio MP3 (b4a + b4i)

postExampleAudio.jpg​

​

Explanation of the Solution​

  1. Audio Session Configuration on iOS:
    • On iOS, audio playback is determined by the right configuration of the audio session (AVAudioSession). By default, iOS might block or mute sounds if the audio session just isn’t explicitly configured.
    • The AVAudioSessionClassPlayagain class permits audio to play even when the gadget is in silent mode (mute).
  2. Adding Code to Application_Start:
    • The setAudioSession technique is known as firstly of the applying to configure the audio session. This ensures that the app is able to play MP3 sounds as quickly as wanted.
  3. Using Native Code (Objective-C):
    • Since B4i doesn’t have a direct API to configure the audio session, you used native Objective-C code to entry the AVAudioSession class and set the audio class.
    • The Objective-C snippet (#If OBJC) configures the audio session and handles potential errors, logging them…

Read extra

HI-FI News

by way of B4X Programming Forum https://ift.tt/JRUdlyw

March 12, 2025 at 04:45PM