Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

I have autoplay on web view, but what code do i need to apply this to mobile?



Hey guys, this code I have found/put together from what i know, but when previewing in mobile, my hidden audio block doesn't autoplay. Can anyone help please?

window.addEventListener('DOMContentLoaded', function() { //wait for document load
    var audio = document.querySelector('.sqs-audio-embed'); //select the audio block
        var checkOnLoad = function() {
            if (window.pageYOffset > 200) {
            } else {
          {audio.loop = true;}
        if (audio) {
            var url = audio.getAttribute('data-url'); //get the audio src
            audio = new Audio(url);
            window.addEventListener('load', checkOnLoad); //listen for window load and toggle audio state

Edited by IanHost
added tags
Link to comment
  • Answers 2
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

2 answers to this question

Recommended Posts

Create an account or sign in to comment

You need to be a member in order to leave a comment

  • Create New...