Help Center> Huawei HiLens> SDK Reference> Output> Playing an Audio File
Updated on 2023-06-15 GMT+08:00

Playing an Audio File

This section describes how to play a local audio file in AAC format. Connect a headset or sound box to the audio output port of the HiLens Kit device. You can hear the sound calling this API.

  • API calling

    HiLensEC PlayAacFile(const std::string filePath, int vol)

  • Parameter description
    Table 1 Parameters

    Parameter

    Description

    filePath

    Absolute path of the local audio file. Chinese characters are not supported.

    vol

    Volume of the audio to be played. The value range is [-121, 6].

    This API and the API in Constructing Audio Collectors cannot be called at the same time.

  • Return Value

    If the return value is 0, the operation is successful. Otherwise, the operation fails. Refer to Error Codes for details about the failure response parameters.