[英]MediaElement.js stop autoplay in a page
I use mejsaudio in my wordpress site header. 我在我的wordpress网站标题中使用mejsaudio。 I use it with this code;
我将此代码与之配合使用;
[mejsaudio src="http://specialholidayinturkey.org/special-fon.mp3" volume="1" autoplay="true" loop="true"]
so it starts in everypage in my site. 因此它开始于我网站的每个页面。
But I want to stop it in my video page. 但是我想在我的视频页面中停止它。 I need a java code to stop it i think.
我需要一个Java代码来阻止它。
Pls help me. 请帮助我。
尝试使用本机HTML5方法暂停:
$('#myAudioElement').pause();
I solved it with this code 我用这段代码解决了
<script>
function aud_play_pause() {
var myAudio = document.getElementById("wp_mep_1");
if (myAudio.play) {
myAudio.pause();
} else {
myAudio.pause();
}
}
</script>
<body onLoad="aud_play_pause()">
thanks for your answer. 感谢您的回答。 "wp_mep_1" is my audio id that i saw in my source code of web site.
“ wp_mep_1”是我在网站的源代码中看到的音频ID。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.