Reputation: 247
I'm trying to use mediaelement.js to play youtube video. I need the player to be with only "play/pause" and "fullscreen" controls. Also, i want to autostart video when page loads.
The video needs to be be able to work cross device.
Can anybody help or post an example?
Upvotes: 0
Views: 3351
Reputation: 41143
having an HTML like
<video id="video-player" preload="preload" autoplay="autoplay">
<source type="video/youtube" src="https://www.youtube.com/watch?v=c1-jFLlHLPw" />
</video>
use this js
jQuery(document).ready(function ($) {
player = new MediaElementPlayer('#video-player', {
features: ['playpause', 'fullscreen'],
success: function (mediaElement, domObject) {
mediaElement.load();
mediaElement.play();
}
});
});
See JSFIDDLE
Upvotes: 1