Vimeo method play() doesnt work and player object is undefined when I try to log it from console.
I am initializing vimeo player on my page like this:
<div id="myVideo"></div>
var options = {
url: "https://vimeo.com/showcase/xxxxxxx",
width: window.innerWidth,
height: window.innerHeight,
autoplay: true,
autopause: false,
loop: true,
muted: true,
background: 1
};
var videoPlayer = new Vimeo.Player('myVideo', options);
then I am doing console log in my code
$(document).ready(
function(){
console.log(videoPlayer);
videoPlayer.play();
});
console.log(videoPlayer) works just fine here and prints object, but videoPlayer.play(); does nothing. When I am trying to do console.log(videoPlayer) from browser console I got Uncaught ReferenceError: videoPlayer is not defined. I am trying to start video directly from JS because autoplay doesnt work at all.
Player is initializing fine, but I have to press play button to start the video, but I need it to start automatically.