Javascript - 创建新的音频对象时,它们何时下载?

Javascript - When creating new audio objects, when are they downloaded?

在我的 JS 代码中,我创建了一个包含大量音频对象的数组。但是,在大多数情况下,我不需要所有对象。我的问题是,未使用的音频还会被下载吗?

  audioArray = [];
  audioURLs = ['url0', 'url1', 'url2', 'url3', 'url4'];
  for (let i = 0; i < audioURLs.length; i++) {
    audioArray.push(new Audio(audioURLs[i]));
  }
  audioArray[0].play() //For example

这种情况下会下载音频对象1-4吗?

来自 MDN's documentationAudio 构造函数:

Return value

A new HTMLAudioElement object, configured to be used for playing back the audio from the file specified by url. The new object's preload property is set to auto and its src property is set to the specified URL or null if no URL is given. If a URL is specified, the browser begins to asynchronously load the media resource before returning the new object.

(我的重点)

这包含在规范 here, which is linked from the spec's description of the legacy Audio constructor here 中。

Will the audio objects 1-4 be downloaded in this case?

浏览器将开始从它们的 URL 异步下载资源,是的。