Comunidad de diseño web y desarrollo en internet online

COMO VALIDAR SI UN USUARIO VIO TODO EL VIDEO DE MI PAGINA

Citar            
MensajeEscrito el 30 Abr 2013 06:47 pm
ACTUALMENTE ESTOY HACIENDO UNA PAGINA WEB DE TUTORIALES DE EXCEL PARA UN AMIGO, Y NECESITO VALIDAR QUE EL USUARIO VEA TODO EL VIDEO(YOUTUBE), PARA ASI PORDERLE LLEVAR UN CONTROL A SU AVANCE EN EL CURSO..... DE VERDAD NO TENGO NI IDEA COMO HACERLO....
ACTUALMENTE ESTOY BUSCANDO COMO REGOGERLO DESDE EL IFRAME CON JAVASCRIPT Y HASTA AHORA NO HE ENCONTRADO NADA..
:cry:
AYUDENME JAJAJAJAJA

DE VERDAD
CUALQUIER RESPUESTA ES AYUDA
MUCHAS GRACIAS DE ANTEMANO

Por krtvelas

3 de clabLevel



Genero:Masculino  

ESTUDIANTE PROGRAMACION

chrome
Citar            
MensajeEscrito el 01 May 2013 04:09 am
Te ayudo empezando a decirte que usar mayusculas es como pedir algo a gritos, así dificilmente alguien te ayudará...

Por logoys

Claber

104 de clabLevel



 

firefox
Citar            
MensajeEscrito el 02 May 2013 03:20 pm
gracias soy nuevo por aqui

Por krtvelas

3 de clabLevel



Genero:Masculino  

ESTUDIANTE PROGRAMACION

firefox
Citar            
MensajeEscrito el 02 May 2013 03:32 pm

SOLUCION


bueno les queria compartir q ya he encontrado la forma, y el mismo youtube me dio la solucion. aca se la comparto:
-esta es la documentacion de la api q les ayudara ha entender como funciona

https://developers.google.com/youtube/player_parameters

-y esta es una muestra de como funciona

https://developers.google.com/youtube/youtube_player_demo

--aca esta el codigo q les podria interesar--es como recoger la duracion y el tiempo transcurrido--

https://code.google.com/apis/ajax/playground/?exp=youtube#chromeless_player

yo simplemente valide que en el momento que el tiempo transcurrido llegara a la duracion, q mostre una imagen

Por krtvelas

3 de clabLevel



Genero:Masculino  

ESTUDIANTE PROGRAMACION

firefox
Citar            
MensajeEscrito el 02 May 2013 03:36 pm
<!--
You are free to copy and use this sample in accordance with the terms of the
Apache license (http://www.apache.org/licenses/LICENSE-2.0.html)
-->


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>YouTube Player API Sample</title>
<style type="text/css">
#videoDiv {
margin-right: 3px;
}
#videoInfo {
margin-left: 3px;
}
</style>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
google.load("swfobject", "2.1");
</script>
<script type="text/javascript">
/*
* Polling the player for information
*/


// Update a particular HTML element with a new value
function updateHTML(elmId, value) {
document.getElementById(elmId).innerHTML = value;
}

// This function is called when an error is thrown by the player
function onPlayerError(errorCode) {
alert("An error occured of type:" + errorCode);
}

// This function is called when the player changes state
function onPlayerStateChange(newState) {
updateHTML("playerState", newState);
if (newState==0) {
valida();
}
}
// Display information about the current state of the player
function updatePlayerInfo() {
// Also check that at least one function exists since when IE unloads the
// page, it will destroy the SWF before clearing the interval.

if(ytplayer && ytplayer.getDuration) {
updateHTML("videoDuration", ytplayer.getDuration());
updateHTML("videoCurrentTime", ytplayer.getCurrentTime());
updateHTML("bytesTotal", ytplayer.getVideoBytesTotal());
updateHTML("startBytes", ytplayer.getVideoStartBytes());
updateHTML("bytesLoaded", ytplayer.getVideoBytesLoaded());
}
}

// This function is automatically called by the player once it loads
function onYouTubePlayerReady(playerId) {
ytplayer = document.getElementById("ytPlayer");
// This causes the updatePlayerInfo function to be called every 250ms to
// get fresh data from the player

setInterval(updatePlayerInfo, 250);
updatePlayerInfo();
ytplayer.addEventListener("onStateChange", "onPlayerStateChange");
ytplayer.addEventListener("onError", "onPlayerError");
}

// The "main method" of this sample. Called when someone clicks "Run".
function loadPlayer() {
// The video to load
var videoID = "ylLzyHk54Z0"
// Lets Flash from another domain call JavaScript
var params = { allowScriptAccess: "always" };
// The element id of the Flash embed
var atts = { id: "ytPlayer" };
// All of the magic handled by SWFObject (http://code.google.com/p/swfobject/)
swfobject.embedSWF("http://www.youtube.com/v/" + videoID +
"?version=3&enablejsapi=1&playerapiid=player1",
"videoDiv", "480", "295", "9", null, null, params, atts);
}
function _run() {
loadPlayer();
}
function valida () {
alert("Terminaste");


}
google.setOnLoadCallback(_run);
</script>
</head>
<body style="font-family: Arial;border: 0 none;">
<table>
<tr>
<td><div id="videoDiv">Loading...</div></td>
<td valign="top">
<div id="videoInfo">
<p>Player state: <span id="playerState">--</span></p>
<p>Current Time: <span id="videoCurrentTime">--:--</span> | Duration: <span id="videoDuration">--:--</span></p>
<p>Bytes Total: <span id="bytesTotal">--</span> | Start Bytes: <span id="startBytes">--</span> | Bytes Loaded: <span id="bytesLoaded">--</span></p>
</div>
</td></tr>
</table>
</body>
</html>

Por krtvelas

3 de clabLevel



Genero:Masculino  

ESTUDIANTE PROGRAMACION

firefox
Citar            
MensajeEscrito el 02 May 2013 03:38 pm
ESTA ES LA VALIDACION
function onPlayerStateChange(newState) {
updateHTML("playerState", newState);
if (newState==0) {
valida();
}
}
function valida () {
alert("Terminaste");


}

Por krtvelas

3 de clabLevel



Genero:Masculino  

ESTUDIANTE PROGRAMACION

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.