自动播放在 mediaelement.js 中不起作用
我正在尝试让 mediaplayer.js 自动播放。自动播放与本机音频标签完美配合,但一旦我实现了 mediaelement java 脚本,播放器就可以工作并且看起来很棒,但不会再自动播放。
我尝试过各种 javascript 答案,但没有一个有效,并且我尝试将 autoplay="true" 更改为 auto 或 autoplay 或者...没有任何效果。我在谷歌上也找不到任何关于它的信息。关于 WordPress 的内容有很多,但似乎都不适用于非 WordPress 场景。
文章“Autoplay MediaElementPlayer”说有一个解决方案,但它对我不起作用。
这是我的代码:
<audio controls="controls" autoplay="true">
<source src="music/male.ogg" type="audio/ogg" /> <!--change song here for FF-->
<source src="music/male.m4a" type="audio/mpeg" /><!--change song here for webkit-->
</audio>
我也在每个浏览器中尝试过,但没有结果:IE、Opera、FF、Chrome、Safari 等。
一切都很好,只是一旦 mediaelement javascript 工作,它就不会再自动播放。这是音频标签的一个简单功能。我尝试在提供的演示中实现自动播放,但它在那里也不起作用。
任何帮助都会很棒,谢谢!
我知道有些人可能认为自动播放不是一个好的做法,但我的客户想要它。
I am trying to get mediaplayer.js to autoplay. Autoplay works perfect with the native audio tags but as soon as I implement the mediaelement java script the player works and looks great but will not autoplay anymore.
I've tried various javascript answers, none of which have worked and I have tried changing the autoplay="true" to auto or autoplay or... nothing works. I can't find anything about it on google either. There is a lot about wordpress but none of that seems to apply to non-wordpress scenarios.
The article "Autoplay MediaElementPlayer" said there was a solution but it failed to work for me.
This is my code:
<audio controls="controls" autoplay="true">
<source src="music/male.ogg" type="audio/ogg" /> <!--change song here for FF-->
<source src="music/male.m4a" type="audio/mpeg" /><!--change song here for webkit-->
</audio>
I've tried it in every browser too with no results: IE, Opera, FF, Chrome, Safari etc.
Everything works great except it will not autoplay anymore once the mediaelement javascript works. This is a simple feature of the audio tag. I've tried to implement autoplay in the provided demos and it will not work there either.
Any help would be great, thanks!
I know some might think autoplay is not good practice but my client wants it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这对我来说部分有效。
它适用于 HTML5,但不适用于 Flash 后备。
This works partially for me.
It's works for HTML5 but not for flash fallback.