1e41f4b71Sopenharmony_ci# Audio Playback Development
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci## Selecting an Audio Playback Development Mode
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ciThe system provides a variety of APIs for you to develop audio playback applications. You can select them based on the audio data formats, audio sources, audio usage scenarios, and even the programming language you use. Selecting a suitable class helps you reduce development workload and your application deliver a better effect.
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ci- [AudioRenderer](using-audiorenderer-for-playback.md): provides ArkTS and JS APIs to implement audio output. It supports only the PCM format and requires applications to continuously write audio data. The applications can perform data preprocessing, for example, setting the sampling rate and bit width of audio files, before audio input. This class can be used to develop more professional and diverse playback applications. To use this class, you must have basic audio processing knowledge.
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci- [AudioHaptic](using-audiohaptic-for-playback.md): provides ArkTS and JS APIs for audio playback with audio-haptic effect. It applies to scenarios where haptic feedback needs to be initiated synchronously during audio playback, for example, when there are incoming calls or messages or users are typing.
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci- [OpenSL ES](using-opensl-es-for-playback.md): provides a set of standard, cross-platform native audio APIs. It supports audio output in PCM format and is suitable for playback applications that are ported from other embedded platforms or that implement audio output at the native layer.
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci- [Using OHAudio for Audio Playback](using-ohaudio-for-playback.md): provides a set of native APIs for audio output. These APIs are normalized in design and support both common and low-latency audio channels. They support the PCM format only. They are suitable for playback applications that implement audio output at the native layer.<!--Del-->
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ci- [TonePlayer](using-toneplayer-for-playback.md): provides ArkTS and JS APIs to implement the playback of dialing tones and ringback tones. It can be used to play the content selected from a fixed type range, without requiring the input of media assets or audio data. This class is applicable to specific scenarios where dialing tones and ringback tones are played. It is available only to system applications.<!--DelEnd-->
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ciIn addition to the preceding classes, you can also use Media Kit to implement audio playback.
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci- [AVPlayer](../media/using-avplayer-for-playback.md): provides ArkTS and JS APIs to implement audio playback. It also supports parsing streaming media and local assets, decapsulating media assets, decoding audio, and outputting audio. It can play audio files in MP3 and M4A formats, but not in PCM format.
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci- [SoundPool](../media/using-soundpool-for-playback.md): provides ArkTS and JS APIs to implement short sound playback in low latency mode. It can be used to play short sound effects, such as camera shutter sound effect, key press sound effect, and game shooting sound effect.
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci## Precautions for Developing Audio Playback Applications
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ciTo enable your application to play a video in the background or when the screen is off, the application must meet the following conditions:
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci1. The application is registered with the system for unified management through the **AVSession** APIs. Otherwise, the playback will be forcibly stopped when the application switches to the background. For details, see [AVSession Kit Development](../avsession/avsession-overview.md).
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ci2. The application must request a continuous task to prevent from being suspended. For details, see [Continuous Task](../../task-management/continuous-task.md).
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_ciIf the playback is interrupted when the application switches to the background, you can view the log to see whether the application has requested a continuous task. If the application has requested a continuous task, there is no log recording **pause id**; otherwise, there is a log recording **pause id**.
32