I have a website with real visits and I want to maybe generate a bot views for youtube.
How do I get the person to enter the site and play a youtube video (hidden) just by clicking anywhere on my site?
I can't use the code below for example because youtube doesn't count as view if I use autoplay
<iframe width="420" height="345" src="http://www.youtube.com/embed/oHg5SJYRHA0?autoplay=1" frameborder="0" allowfullscreen></iframe>
I'm a beginner, I tried the code below, but it didn't work.
<html>
<head>
<title>Youtube br</title>
</head>
<style> #botYoutube { opacity: 0; position: absolute; right: 0; top: 0; } </style>
<body onclick="play()">
<div id="botYoutube"></div>
<script async src="https://www.youtube.com/iframe_api"></script>
<script>
var player;
function play(){
player.playVideo();
}
function onYouTubeIframeAPIReady() {
player = new YT.Player('botYoutube', {
videoId: 'x5MhydijWmc', // YouTube Video ID
width: 10, // Player width (in px)
height: 10, // Player height (in px)
playerVars: {
autoplay: 0, // Auto-play the video on load
controls: 1, // Show pause/play buttons in player
showinfo: 0, // Hide the video title
modestbranding: 1, // Hide the Youtube Logo
loop: 1, // Run the video in a loop
fs: 0, // Hide the full screen button
cc_load_policy: 0, // Hide closed captions
iv_load_policy: 3, // Hide the Video Annotations
autohide: 0 // Hide video controls when playing
},
events: {
onReady: function(e) {
e.target.mute();
}
}
});
}
</script>
</body>
</html>
I used google translate to ask this question!
thanks
this is not allowed on Youtube, but you can create a div with a white background, and 420px×375px, and high z-index and place it on top of the player
don't forget autoplay:
autoplay: 0, // Auto-play the video on load
What you are trying to do is against Youtube terms of service and will likely not work anyways. Youtube has protections against this kind of behavior.