Commit de6ce64b by Reda Lemeden

Merge

parents c69cd518 d2c1c795
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -87,6 +87,7 @@ function change_video_speed(speed, youtube_id) { ...@@ -87,6 +87,7 @@ function change_video_speed(speed, youtube_id) {
new_position = ytplayer.getCurrentTime() * video_speed / speed; new_position = ytplayer.getCurrentTime() * video_speed / speed;
video_speed = speed; video_speed = speed;
ytplayer.loadVideoById(youtube_id, new_position); ytplayer.loadVideoById(youtube_id, new_position);
log_event("speed", {"new_speed":speed, "clip":youtube_id});
} }
function caption_at(index) { function caption_at(index) {
...@@ -298,6 +299,7 @@ function onytplayerStateChange(newState) { ...@@ -298,6 +299,7 @@ function onytplayerStateChange(newState) {
function onPlayerError(errorCode) { function onPlayerError(errorCode) {
// alert("An error occured: " + errorCode); // alert("An error occured: " + errorCode);
log_event("player_error", {"error":errorCode});
} }
// Currently duplicated to check for if video control changed by clicking the video for HTML5 // Currently duplicated to check for if video control changed by clicking the video for HTML5
...@@ -349,6 +351,7 @@ function loadNewVideo(id, startSeconds) { ...@@ -349,6 +351,7 @@ function loadNewVideo(id, startSeconds) {
catch(e) { catch(e) {
window['console'].log(JSON.stringify(e)); window['console'].log(JSON.stringify(e));
} }
log_event("load_video", {"id":id,"start":startSeconds});
//$("#slider").slider("option","value",startSeconds); //$("#slider").slider("option","value",startSeconds);
//seekTo(startSeconds); //seekTo(startSeconds);
} }
...@@ -363,18 +366,21 @@ function play() { ...@@ -363,18 +366,21 @@ function play() {
if (ytplayer) { if (ytplayer) {
ytplayer.playVideo(); ytplayer.playVideo();
} }
log_event("play_video", {"id":getCurrentTime(), "code":getEmbedCode()});
} }
function pause() { function pause() {
if (ytplayer) { if (ytplayer) {
ytplayer.pauseVideo(); ytplayer.pauseVideo();
} }
log_event("pause_video", {"id":getCurrentTime(), "code":getEmbedCode()});
} }
function stop() { function stop() {
if (ytplayer) { if (ytplayer) {
ytplayer.stopVideo(); ytplayer.stopVideo();
} }
log_event("stop_video", {"id":getCurrentTime(), "code":getEmbedCode()});
} }
function getPlayerState() { function getPlayerState() {
...@@ -426,11 +432,15 @@ function unMute() { ...@@ -426,11 +432,15 @@ function unMute() {
} }
function getEmbedCode() { function getEmbedCode() {
alert(ytplayer.getVideoEmbedCode()); if(ytplayer) {
ytplayer.getVideoEmbedCode();
}
} }
function getVideoUrl() { function getVideoUrl() {
alert(ytplayer.getVideoUrl()); if(ytplayer) {
ytplayer.getVideoUrl();
}
} }
function setVolume(newVolume) { function setVolume(newVolume) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment