开发者

Autoplay not working in mediaelement.js

开发者 https://www.devze.com 2023-03-30 07:39 出处:网络
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 a

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-->
    &l开发者_开发技巧t;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.


This works partially for me. It's works for HTML5 but not for flash fallback.

vplayer = new MediaElementPlayer('video');
vplayer.play();
0

精彩评论

暂无评论...
验证码 换一张
取 消