Ios Wechat version 6.7.1 will not trigger canplay? before playing after the audio is loaded.

Target: get the file length before the audio is played.
Terminal: ios Wechat version 6.7.1
phenomenon: the canplay event will only be triggered when the user manually clicks the play button.

related codes

  var audio = document.getElementById("audio");

  audio.addEventListener("canplay", function(e) {
     console.log(audio.duration);
  });
What is the reason for

? What are we going to do about it?

Jun.21,2021

canplay can only be triggered by clicking play on ios. If you want to obtain the duration, you can try the loadedmetadata event

.
audio.addEventListener('loadedmetadata', function (e) {
  console.log(this.duration)
})
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-1b36243-2bfe7.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-1b36243-2bfe7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?