ESP-Player-Service Component

[中文]

Introduction to ESP Player Service

ESP Player Service is a playback side (SINK) service provided by Espressif in ESP-ADF, which is based on ESP Player for demultiplexing, decoding, and rendering. On the product side, a playback instance is used to manage the speakers and screens on a development board.

Compared with using ESP Player directly, this service additionally provides multi-channel simultaneous playback, mixing and preemption, playlist, and direct connection with collection / protocol services, suitable for speakers, story machines, voice assistants, and screen audio and video products that need to stack background music, prompt tones, TTS or videos on the same device.

How to Choose Among Three Components

You can choose a subclass based on the board’s capabilities: audio subclass for screenless products; video subclass for screen products. If you already have an audio instance and add a screen later, you can hang the display on the original instance without having to open another playback service. Do not create audio and video instances on the same board at the same time, otherwise the same speaker will become two sets of mixing.

Component

Positioning

Typical Customers

esp_audio_player_service

Automatically dock with board-level DAC

Screenless speakers, story machines, voice assistants

esp_video_player_service

Automatically dock with board-level LCD and DAC, the same instance outputs sound and picture

Screen audio and video, visual doorbell, smart display

esp_player_service

Playback core; only used directly when PCM output is not board-level DAC

Custom write PCM, self-managed codec solution

Screenless products use the audio subclass; screen products use the video subclass. If you already have an audio instance and add a screen later, you can hang the display on the original instance without having to open another playback service.

Main Capabilities

Capability

Description

Multi-channel Playback

One instance corresponds to the output of a board; background music, TTS, prompt tones, videos, etc. are stacked as different channels

Mixing and Preemption

Volume can be set by channel; three levels of priority (background / notification / emergency), can coexist to suppress or monopolize to interrupt

Multiple Inputs

Local / HTTP(S) / HLS URLs; application feeds frames (such as TTS); directly connected with collection, RTSP / RTMP / SIP and other source services, no need for the application to move frames itself

Playback Control

Play, pause, continue, stop, Seek, speed; can check duration, progress and status

Playlist

Previous / next / jump, loop mode, automatic song switching after playing

Audio and Video Integration

A maximum of one audio and one video stream can be synchronized on the same route; a single screen shares one display

ID3

Bare MP3 can parse song name and other information

Typical application scenarios

Scenario

Description

Speaker / Story machine

Background music and prompt sounds, TTS sound simultaneously, lower or interrupt music when notification arrives

Voice assistant

Coexist or preempt with the content being played when broadcasting answers

Screen terminal

Local or network video playback, simultaneously overlay prompt sound or TTS

Protocol / Collection cascade

Media from source services such as camera preview, intercom, and stream pulling are directly sent to this machine for playback, no need for application forwarding

How ESP Player and ESP Player Service divide the work

ESP Player is the underlying player: one source, from demuxing to sound and picture output. ESP Player Service is a product-level encapsulation: multi-channel, mixing, list, and docking with other media services, and automatically connecting to DAC / LCD according to the development board.

If customers only need single-channel playback and manage the output themselves, ESP Player is recommended; if they need multi-channel overlay or to string together with collection / protocol services, this service is recommended.

How to use

Add espressif/esp_audio_player_service for screenless products, and espressif/esp_video_player_service for screen products. You can add the corresponding component to the project by entering the following command idf.py add-dependency "espressif/esp_audio_player_service" in the project. Board-level peripherals are managed by ESP Board Manager. For detailed usage, see the README of each component.

FAQ

Can audio and video services be created at the same time?

Do not create an instance for each on the same speaker. Use video playback service directly for screen; add display on existing instance if audio is done first and screen is added later.

How to choose between ESP Player, Audio Simple Player?

Only play one audio channel, simple capability requirements: Audio Simple Player. Single-channel audio and video, self-connect rendering: ESP Player. If you need multi-channel mixing, list or direct connection with collection / SIP / RTSP on the product: ESP Player Service.