**Note**: If the status is **Idle**, setting the **src** attribute does not change the status. In addition, after the **src** attribute is set successfully, you must call **reset()** before setting it to another value.
**Figure 2** Layer 0 diagram of audio playback
**Figure 2** Layer 0 diagram of audio playback
...
@@ -197,8 +199,8 @@ export class AudioDemo {
...
@@ -197,8 +199,8 @@ export class AudioDemo {
}
}
asyncaudioPlayerDemo(){
asyncaudioPlayerDemo(){
letaudioPlayer=media.createAudioPlayer();// Create an AudioPlayer instance.
letaudioPlayer=media.createAudioPlayer();// Create an AudioPlayer instance.
this.setCallBack(audioPlayer);// Set the event callbacks.
this.setCallBack(audioPlayer);// Set the event callbacks.
letfdPath='fd://'
letfdPath='fd://'
// The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\01.mp3 /data/app/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile" command.
// The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\01.mp3 /data/app/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile" command.