Cómo evitar que adelanten un vídeo en YouTube

  • Autor Autor WebmasterKing
  • Fecha de inicio Fecha de inicio
W

WebmasterKing

Hola amigos!

lo que pasa es que tengo un vídeo de 15 minutos y yo se que mucho se aburrirán y lo adelantaran y no quiero que me adelanten el vídeo hay algún plugin que evite que adelanten un vídeo de youtube o vimeo?
 
¿Algo así?

http://www.filegoogle.com/netflix/youtube.php


Insertar CODE, HTML o PHP:
<script type="text/javascript">
	var id = 'jHRKiOnI45E';

	function onYouTubePlayerReady(playerId) {
		ytplayer = document.getElementById("ytplayer");
		document.getElementById('fondopreview').innerHTML = '<img src="http://i1.ytimg.com/vi/'+id+'/hqdefault.jpg" style="width:100%; height:100%">';
	}
	function PauseVideo(){
		ytplayer.pauseVideo();
		document.getElementById('accion').innerHTML = '<a href="#" onclick="ContinueVideo(); return false">Continuar video</a>';
	}
	function ContinueVideo(){
		ytplayer.playVideo();
		document.getElementById('accion').innerHTML = '<a href="#" onclick="PauseVideo(); return false">Pausar video</a>';
	}
	function PlayVideo(){
		ytplayer.loadVideoById(id, 5, "large");
		document.getElementById('accion').innerHTML = '<a href="#" onclick="PauseVideo(); return false">Pausar video</a>';
	}
</script>
<div id="reproductor" style="width:420px; height:315px; position:relative">
	<div id="fondopreview" style="z-index:1; position:absolute; width:100%; height:100%"></div>
	<div style="z-index:3; width:100%; height:100%; position:absolute"></div>
	<div id="player" style="z-index:2; position:absolute">
		<object type="application/x-shockwave-flash" id="ytplayer" data="http://www.youtube.com/apiplayer?enablejsapi=1&amp;version=3&amp;playerapiid=ytplayer" width="420" height="315">
			<param name="allowScriptAccess" value="always">
			<param name="wmode" value="transparent">
		</object>
	</div>
</div>
<br>
<div id="accion">
	<a href="#" onclick="PlayVideo(); return false">Comenzar video</a>
</div>




Tambien esta este que hice:
http://www.filegoogle.com/netflix/youtube2.php

Pero pueden clickear en YouTube e ir al video :/

Insertar CODE, HTML o PHP:
<script type="text/javascript">
	var tiempo = 0;
	function onYouTubePlayerReady(playerId) {
		ytplayer = document.getElementById("ytplayer");
		inter = setInterval("tomartiempo()", 10);
	}

	function tomartiempo(){
		tiempoact = ytplayer.getCurrentTime();
		tiemporest = tiempoact-tiempo;
		if(tiemporest > 5){
			ytplayer.seekTo(tiempo);
		}else{
			tiempo = tiempoact;
		}
	}
</script>

<object type="application/x-shockwave-flash" id="ytplayer" data="http://www.youtube.com/v/jHRKiOnI45E?version=3&enablejsapi=1" width="420" height="315">
	<param name="allowScriptAccess" value="always">
	<param name="wmode" value="transparent">
</object>
 
Última edición:
Wow. Excelente trabajo (Y). Y como los puedo implementar en mi propia web?
Hay que tener una cuenta en Youtube developers??
Gracias.
 
Podria meterse en un PHP asi:

Insertar CODE, HTML o PHP:
<?php

$id = $_GET['id'];

?>
<html>
<head>
<script type="text/javascript">
	var tiempo = 0;
	function onYouTubePlayerReady(playerId) {
		ytplayer = document.getElementById("ytplayer");
		inter = setInterval("tomartiempo()", 10);
	}

	function tomartiempo(){
		tiempoact = ytplayer.getCurrentTime();
		tiemporest = tiempoact-tiempo;
		if(tiemporest > 5){
			ytplayer.seekTo(tiempo);
		}else{
			tiempo = tiempoact;
		}
	}
</script>
</head>
<body style="margin:0">
	<object type="application/x-shockwave-flash" id="ytplayer" data="http://www.youtube.com/v/<?=$id?>?version=3&enablejsapi=1" width="420" height="315">
		<param name="allowScriptAccess" value="always">
		<param name="wmode" value="transparent">
	</object>
</body>
</html>


Y luego se lo llama así:
Insertar CODE, HTML o PHP:
<iframe src="http://loquesea.com/archivo.php?id=IDDEYOUTUBE" width="420" height="315" frameborder="no" scrolling="no"></iframe>


No es necesaria la cuenta developer.
 
Última edición:
Podria meterse en un PHP asi:

Insertar CODE, HTML o PHP:
<?php

$id = $_GET['id'];

?>
<html>
<head>
<script type="text/javascript">
	var tiempo = 0;
	function onYouTubePlayerReady(playerId) {
		ytplayer = document.getElementById("ytplayer");
		inter = setInterval("tomartiempo()", 10);
	}

	function tomartiempo(){
		tiempoact = ytplayer.getCurrentTime();
		tiemporest = tiempoact-tiempo;
		if(tiemporest > 5){
			ytplayer.seekTo(tiempo);
		}else{
			tiempo = tiempoact;
		}
	}
</script>
</head>
<body style="margin:0">
	<object type="application/x-shockwave-flash" id="ytplayer" data="http://www.youtube.com/v/<?=$id?>?version=3&enablejsapi=1" width="420" height="315">
		<param name="allowScriptAccess" value="always">
		<param name="wmode" value="transparent">
	</object>
</body>
</html>


Y luego se lo llama así:
Insertar CODE, HTML o PHP:
<iframe src="http://loquesea.com/archivo.php?id=IDDEYOUTUBE" width="420" height="315" frameborder="no" scrolling="no"></iframe>


No es necesaria la cuenta developer.
muchísima gracias amigo, pero yo necesito que se reproduzca automáticamente, hay alguna manera de hacerlo?
 
muchísima gracias amigo, pero yo necesito que se reproduzca automáticamente, hay alguna manera de hacerlo?

Solo agregale &autoplay=1

Debería quedar así:
Insertar CODE, HTML o PHP:
data="http://www.youtube.com/v/<?=$id?>?version=3&enablejsapi=1"

A así:
Insertar CODE, HTML o PHP:
data="http://www.youtube.com/v/<?=$id?>?version=3&enablejsapi=1&autoplay=1"



Y para el otro:
Insertar CODE, HTML o PHP:
	function onYouTubePlayerReady(playerId) {
		ytplayer = document.getElementById("ytplayer");
		document.getElementById('fondopreview').innerHTML = '<img src="http://i1.ytimg.com/vi/'+id+'/hqdefault.jpg" style="width:100%; height:100%">';
	}


Agregas a la función esto PlayVideo();

Quedaría así:
Insertar CODE, HTML o PHP:
	function onYouTubePlayerReady(playerId) {
		ytplayer = document.getElementById("ytplayer");
		document.getElementById('fondopreview').innerHTML = '<img src="http://i1.ytimg.com/vi/'+id+'/hqdefault.jpg" style="width:100%; height:100%">';
		PlayVideo();
	}
 
Última edición:
Solo agregale &autoplay=1

Debería quedar así:
Insertar CODE, HTML o PHP:
data="http://www.youtube.com/v/<?=$id?>?version=3&enablejsapi=1"

A así:
Insertar CODE, HTML o PHP:
data="http://www.youtube.com/v/<?=$id?>?version=3&enablejsapi=1&autoplay=1"



Y para el otro:
Insertar CODE, HTML o PHP:
	function onYouTubePlayerReady(playerId) {
		ytplayer = document.getElementById("ytplayer");
		document.getElementById('fondopreview').innerHTML = '<img src="http://i1.ytimg.com/vi/'+id+'/hqdefault.jpg" style="width:100%; height:100%">';
	}


Agregas a la función esto PlayVideo();

Quedaría así:
Insertar CODE, HTML o PHP:
	function onYouTubePlayerReady(playerId) {
		ytplayer = document.getElementById("ytplayer");
		document.getElementById('fondopreview').innerHTML = '<img src="http://i1.ytimg.com/vi/'+id+'/hqdefault.jpg" style="width:100%; height:100%">';
		PlayVideo();
	}

el codigo entero para que no lo puedan adelantar y se respodrusca solo cual es?, por que yo no se de programación yo solo puedo cambiarle el vídeo al código es decir tu me pasas el código que es y si sabría reemplazar la url del vídeo por la mía solo eso se hacer puedes pasarme el código completo?
 
Metes esto en un archivo .php
Insertar CODE, HTML o PHP:
<?php

$id = $_GET['id'];

?>
<html>
<head>
<script type="text/javascript">
	var tiempo = 0;
	function onYouTubePlayerReady(playerId) {
		ytplayer = document.getElementById("ytplayer");
		inter = setInterval("tomartiempo()", 10);
	}

	function tomartiempo(){
		tiempoact = ytplayer.getCurrentTime();
		tiemporest = tiempoact-tiempo;
		if(tiemporest > 5){
			ytplayer.seekTo(tiempo);
		}else{
			tiempo = tiempoact;
		}
	}
</script>
</head>
<body style="margin:0">
	<object type="application/x-shockwave-flash" id="ytplayer" data="http://www.youtube.com/v/<?=$id?>?version=3&enablejsapi=1&autoplay=1" width="420" height="315">
		<param name="allowScriptAccess" value="always">
		<param name="wmode" value="transparent">
	</object>
</body>
</html>


Y luego se lo llama así:
Insertar CODE, HTML o PHP:
<iframe src="http://loquesea.com/archivo.php?id=IDDEYOUTUBE" width="420" height="315" frameborder="no" scrolling="no"></iframe>
 
yo solo digo que si tus usuarios se aburren de tu contendido, ¿no seria mejor idea mejorar el contenido?
-
Ademas, esos reproductores que no se pueden adelantar son muy frustrantes de cara al usuario.
 
Si el video es aburrido y no se puede adelantar hasta lo que interesa, directamente se irán de la web a buscarlo en otro lado.

Yo es lo que haría, sino tengo libertad de decisión de qué ver y cuando verlo, me molesta y me voy del sitio.
 
Atrás
Arriba