Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

iOS HTML5 Audio Element currentTime not getting set

$
0
0

@jqx23 wrote:

I currently have an html audio element in my html document and my code looks like this

 audio.currentTime = times[i].first;
        playPromise = audio.play();
        if (playPromise != undefined) {
          playPromise.then( () => {
            timer = setTimeout( () => {
              audio.pause();
            }, (times[i].last-times[i].first)*1000);
          })
          .catch( e => console.log(e));
        }

and this works fine on android devices/chrome, but when I play it on an iOS emulator, the first time the audio gets played it gets cut off early since the currentTime isn’t getting set to what it’s supposed to begin at, but all the other ones work. I tried adding

audio.oncanplaythrough = () => {
            audio.currentTime = audio[i].start;
          }

and audio works correctly on iOS but then it completely doesn’t play on android.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>