I have a video iframe in my website page for this I am using youtube and vimeo videos and change iframe src on finish video.
My code is :
<script src="http://www.youtube.com/player_api"></script>
<script src="https://f.vimeocdn.com/js/froogaloop2.min.js"></script>
function onYouTubePlayerAPIReady()
{
player = new YT.Player('video_player', {
events: {
'onStateChange': changeVideoSrc,
'onReady': onPlayerReady
}
});
}
function changeVideoSrc()
{
// here changing the iframe src
}
$('#main iframe').load(function() {
var iframe = $('#video_player');
var player = $f(iframe);
player.addEvent('ready', function() {
player.addEvent('finish', onFinish);
});
function onFinish(id)
{
// here changing the iframe src
}
});
All are working, but in console there is a error generated on change iframe src that is :
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://www.youtube.com') does not match the recipient window's origin ('https://player.vimeo.com').
I have also try to add vimeo
message
event listener but it is not working for me.
How to remove this error from console?