How to get the duration and size of audio url based on java

for example, how to obtain the duration and size according to url, such as http://XXXXXXXXXapyuh.mp3, and put it on Ali CVM

Mar.23,2021

acquisition duration:

  var audio = document.createElement('audio');
  audio.src = 'www.baidu.com';
  audio.addEventListener("canplay", function(){
      var sc=parseInt(document.getElementById('audio1').duration);
  });

get the size has not been tried, according to the upstairs try


this can only be read when it is provided to the request header. If the file size is similar, head usually takes the response header of the corresponding url. For example, if we use the head method to access the download link of maven, we can get the following response header:

HTTP/1.1 200 OK
ETag: "******************"
Content-Type: application/zip
Last-Modified: Sat, 24 Feb 2018 19:51:39 GMT
X-Checksum-MD5: **************************
X-Checksum-SHA1: ********************************
Via: 1.1 varnish
Accept-Ranges: bytes
Age: 2319984
Content-Length: 8958105
Accept-Ranges: bytes
Date: Tue, 03 Jul 2018 08:17:33 GMT
Via: 1.1 varnish
Connection: keep-alive
X-Served-By: cache-iad2145-IAD, cache-sea1046-SEA
X-Cache: HIT, HIT
X-Cache-Hits: 0, 0
X-Timer: S1530605854.978168,VS0,VE0

here Content-Length is the file size

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3bb61-2c2e3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3bb61-2c2e3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?