目录

FAQs About Using AVCastPicker

This document describes the typical problems that occur when you use AVCastPicker in audio and video apps and how to locate and solve the problems. You can further locate the faults based on the media session management error codes and HiLog.

Why Is the Device List Empty After the Component Is Started?

Symptom

After AVCastPicker is clicked, the device selection page is empty.

Possible causes

Solution

  1. Create an AVSession of the corresponding type. Take the call scenario as an example. For details about how to create a voice_call session, see Switching Call Output Devices.
  2. Ensure that there are remote devices available for casting. The remote device can be a PC/2-in-1 device running HarmonyOS 5.0.0 or later, a TV running HarmonyOS 3.1 or later, or other devices that support the standard DLNA protocol.

Why Is the Custom Style Not Refreshed with Device Switching?

Symptom

customPicker is used to customize a component style, but the style is not updated after the device is switched.

Possible causes

The custom style does not automatically refresh with the device change. The app needs to refresh the style based on the device change.

Solution

Listen to the audio device switchover event using on('preferOutputDeviceChangeForRendererInfo'), and call getPreferredOutputDeviceForRendererInfoSync in the callback to obtain the current device, and refresh the custom style. For details, see Implementing a Custom Style.