Hi, I have Implemented Vimeo Video and it works fine, but the Issue iam facing is when ever the Video ends (Add Listener) Events are Not Working.
note : onclick of the image iam playing video.
(function($) {
$(function() {
//alert('hi')
//var thumbSelector = $('.gwt__embed__video .flex-viewport, .sliderNew #carousel, .sliderNew .flex-direction-nav');
//var dotSelector = $('.gwt__embed__video .flex-viewport, .flex-control-nav.flex-control-paging, .flex-direction-nav, flex-control-nav');
//var slidFalse = $('.sliderNew .flexslider').flexslider({ slideshow: false });
//var slidTrue = $('.sliderNew .flexslider').flexslider({ slideshow: true });
var iframe = $('#player1')[0];
var player = $f(iframe);
var status = $('.status');
console.log("01 player" + player); // result null
// When the player is ready, add listeners for pause, finish, and playProgress
// Call the API when a button is pressed
$('#test_1').on('click', function() {
$('#test_1').hide();
imgClick1();
//$('#player1').show();
//$('.gwt__video__wrap .close').show();
// player.api($(this).text().toLowerCase());
console.log("02 on click player" + player); //
});
function imgClick1() {
var tag1 = document.createElement('script');
tag1.src = "http://a.vimeocdn.com/js/froogaloop2.min.js";
var firstScriptTag1 = document.getElementsByTagName('script')[0];
firstScriptTag1.parentNode.insertBefore(tag1, firstScriptTag1);
var ifrm = document.createElement("IFRAME");
ifrm.setAttribute("src", "https://player.vimeo.com/video/76979871?api=1&player_id=player1&autoplay=1");
ifrm.setAttribute("id", "vplayer");
ifrm.setAttribute("class", "vimeo-player");
ifrm.style.width = "100%";
ifrm.style.height = "224px";
// add rest of your values
ifrm.frameborder = 0;
document.getElementById("vPlayer").appendChild(ifrm);
jQuery('iframe#vplayer').each(function(){
alert('eaci............')
$f(this).addEvent('ready', ready);
});
function ready(player_id){
$f(player_id).addEvent('play', play);
$f(player_id).api('play');
alert("Ready!!!");
}
function play(){
alert("Playing!!!");
}
$('#vPlayer iframe').load(function() {
alert('On Load Function.')
//player = document.querySelectorAll('iframe')[0];
console.log("neeeeeeeeeeee" + player);
// $('#vPlayer iframe').attr('id', videoData[0]['id']);
/* $f(player).addEvent('ready', function(id){
var vimeoVideo = $f(id);
console.log('success');
}); */
function videoEnd() {
alert('hello mister')
}
});
}
function onPause(id) {
status.text('paused');
}
function onFinish(id) {
alert("eeee");
}
function onPlayProgress(data, id) {
status.text(data.seconds + 's played');
}
});
})(jQuery);
Thanks!!