Can the browser console use JS to call local MP3 and play?

if you can"t do it locally, is it okay to have an online MP3 file?

Jun.21,2021

var start = function(){
  var audio = document.createElement('audio')
  audio.controls = true
  audio.src = 'http://dl.stream.qqmusic.qq.com/M800004EkUyf2jSgJI.mp3?vkey=0CAB4E3747C490D53DD9B46150B7C7E01AF533C287F22BDACFE22C35C31098F7F2DCCF8A04478230E3115FC6756FDFBE132F618AF773F406&guid=5150825362&fromtag=1'
  audio.play()
}
start()

definitely not local, online. However, it cannot be played automatically. Now browsers have restrictions. Programs are generally not allowed to trigger automatic playback. External events are required to trigger


suddenly remembered a way to play online, the latest version of chrome can be achieved. You can try it on the console of this page.

document.getElementById('shareToWeiboModal').outerHTML = '<iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=330 height=86 src="//music.163.com/outchain/player?type=2&id=502644308&auto=1&height=66"></iframe>'
Menu