My website has a collection of video links that open in a fancybox when clicked using jQuery. However, there is an issue where the videos used to play with sound automatically, but now they require manual unmuting. I am unsure of why this behavior changed.
After researching and following documentation, I generated an app ID and integrated the code snippet below into the onclick jQuery function:
window.fbAsyncInit = function() {
FB.init({
appId : '111111111111',
xfbml : true,
version : 'v2.5'
});
var my_video_player;
FB.Event.subscribe('xfbml.ready', function(msg) {
if (msg.type === 'video') {
my_video_player = msg.instance;
my_video_player.play();
my_video_player.unmute();
}
});
};
The above code successfully works on the first click, but subsequent clicks on other video links do not load the videos. Only the first video loads each time.
I am seeking guidance on how to ensure the above code functions multiple times within an onclick function without the need for page reloads.