简体   繁体   中英

MediaElement.js doesn't pause on iOS

I use JQM 1.4 and MediaElements (latest)...

I use multipage template and I want to pause the audio player every time I change the page...

I use this code...

$(document).on("pagebeforeshow", function (e, ui) {
    $("audio").each(function () {
        $(this)[0].pause(); 
    });
});

It works fine on Android and Firefox but a problem arises in iOS ...

The audio tag has id="audio_element" .

I tried different solutions... I have the identical problem... mediaelement.js - pause all players (iOS) (the question is old so I guess code has changed).

So I don't know other solutions... any idea ?

Try:

$(document).on("pagebeforeshow", function (e, ui) {
    $("audio").each(function () {
        this.player.pause(); 
    });
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM