Duration of song

Hi, i need to know the duration of any song but i don’t want to play it.
I found cc.audioEngine.getDuration(id) but requires an id.
I tryied to do my own getDuration using this way.

getDuration(audioClip: cc.AudioClip) {
    let id: number = cc.audioEngine.playMusic(audioClip, false);
    let duration : number = cc.audioEngine.getDuration(id)
    cc.audioEngine.stop(id)
    return duration
}

But this stops all instances of this audioClip, and can generate bugs in the future.
Any approach to do that i cocos creator?