Audio format ogg on iOS

Hi all!

I am using Cocos Creator version 3.8.3.

The documentation says:

.ogg is an open source lossy audio compression format, which has the advantage of supporting multi-channel encoding and using a more advanced acoustic model to reduce the loss of sound quality, while the file size is smaller than .mp3 format under the same conditions. Currently all the built-in ringtones for Android also use .ogg files. This format is not supported by iOS

I would like to draw special attention to the following phrase:

This format is not supported by iOS

I’m a bit confused. There are libraries such as libvorbis and libogg. So I want to clarify. If I build the game for web-mobile and include music in ogg format, will it work in iOS browsers? But if I build it specifically for iOS, it won’t work?

Supported Audio File and Data Formats in OS X : Here is the link shows supported audio format in IOS.
IOS does not natively support the OGG audio format. This means that you cannot directly play OGG files on iPhones, iPads, or other Apple devices using the default Music app or most other media players that are designed to work with iOS’s native capabilities.

However, there are workarounds for this limitation:

  1. Convert OGG to a Supported Format: You can convert OGG files to a format that iOS does support, such as MP3 or AAC, using various audio conversion tools available online or as standalone applications.
  2. Use Third-Party Apps: Some third-party apps available on the App Store may support OGG playback. These apps implement their own decoding capabilities and can play OGG files without the need for conversion.
  3. Web Audio: If you’re trying to play OGG files within a web application on an iOS device, you might encounter limitations due to iOS’s restrictions on autoplay and the need for user interaction to initiate audio playback.
  4. Custom Development: For developers, it’s possible to use lower-level APIs like AudioQueue or Audio Toolbox to implement OGG playback in custom apps. This approach requires a good understanding of audio programming and the willingness to maintain custom code for audio decoding.

It’s important to note that while these workarounds can enable OGG playback on iOS, they may not provide the same level of integration or ease of use as playing natively supported audio formats.

It is clear that if iOS does not support it, then those who use the system API will not support it either. My question is not in general, but specifically regarding the Cocos Creator engine version 3.8.3. Does the engine use only the system API or does it implement ogg playback bypassing the system? For example, it was possible to use libvorbis and libogg.

Well, I didn’t understand about the assembly for Web-desktop/mobile and subsequent launch in the browser. In that case, it’s better to forget about the ogg format?

I suggest you to use mp3 directly in your case.