8 Pro Tips for Taking Incredible Pictures of Your Pets

More from mental floss studios

‘);
} else if (isMobile) {
jQuery(‘.in-aricle-video ‘).html(”);
jQuery(”).insertAfter(“#myPlayerID”);
}

var s = document.createElement(‘script’);
s.src = “//players.brightcove.net/5121028900001/” + player_id + “_default/index.min.js”;
document.body.appendChild(s);
s.onload = callback;

var tags = jQuery(‘#article-1’).attr(‘data-tags’);
var video_sponsored = true;
var myPlayer;
var isAdPlaying = false;
var playerSeen = false;
var playerHasShrunk = false;
var startPlayingOnScroll = true;
var addBorder = false;

function callback() {
videojs(“myPlayerID”).ready(function () {
myPlayer = this;
myPlayer.ima3.adMacroReplacement = function (url) {
var parameters = {
‘{macro_tags}’: window.parent.tags.substring(1, window.parent.tags.length-1),
‘{macro_sponsored}’: window.parent.video_sponsored,
‘{macro_url}’: window.parent.location.href,
‘{macro_duration}’:myPlayer.mediainfo.duration,
‘{macro_separation}’: window.parent.separation,
‘{macro_id}’: “535749”,
};
for (var i in parameters) {
url = url.split(i).join(encodeURIComponent(parameters[i]));
}
return url;
}

jQuery( “button.vjs-play-control” ).click(function(event) {
event.preventDefault();
if(jQuery( “button.vjs-play-control”).hasClass(“vjs-paused”) ){
startPlayingOnScroll = true;
ga(‘send’, ‘event’, ‘Brightcove In Article Player’, ‘Click on Play’, myPlayer.mediainfo.id + ‘|’ + myPlayer.mediainfo.name);
}else if(jQuery( “button.vjs-play-control”).hasClass(“vjs-playing”) ) {
startPlayingOnScroll = false;
ga(‘send’, ‘event’, ‘Brightcove In Article Player’, ‘Click on Pause’, myPlayer.mediainfo.id + ‘|’ + myPlayer.mediainfo.name);
}
});

jQuery( “button.vjs-mute-control” ).click(function(event) {
event.preventDefault();
myPlayer.muted() === true ?ga(‘send’, ‘event’, ‘Brightcove In Article Player’, ‘Volume Change – Mute’, myPlayer.mediainfo.id + ‘|’ + myPlayer.mediainfo.name) : ga(‘send’, ‘event’, ‘Brightcove In Article Player’, ‘Volume Change – Unmute’, myPlayer.mediainfo.id + ‘|’ + myPlayer.mediainfo.name);
});

checkIfVideoInView = function () {
// check if we are in ad or content playback
// and get reference to the relevant player
var currentPlayer = !isAdPlaying ? myPlayer : myPlayer.ima3.adPlayer;
if (isScrolledIntoViewVideo(myPlayer.el())) {
// the player is fully in the viewport
if(playerSeen == false){
playerSeen = true;
ga(‘send’, ‘event’, ‘Brightcove In Article Player’, ‘Player seen’, myPlayer.mediainfo.id + ‘|’ + myPlayer.mediainfo.name);
}
if(startPlayingOnScroll == true && overlay == false) {
currentPlayer.play();
// ensure the conent player is paused
if (isAdPlaying) {
myPlayer.pause();
}
}
} else {
// the player is not in the viewport
if (!currentPlayer.paused()) {
currentPlayer.pause();
}
}
};

function offScrollVideo($window, offset, $featuredVideo) {
$featuredVideo.toggleClass( “makeVideoticky”,
(lockedFloatVideo == false &&
$window.scrollTop() > offset && (
($window.scrollTop() + $window.height()) 0 && isScrolledIntoView(“#article-2 .article-body”))
|| (lockedFloatVideo == false && jQuery(“#article-3”).length > 0 && isScrolledIntoView(“#article-3 .article-body”))
);

$featuredVideo.toggleClass( “smallWidth”,
lockedFloatVideo == false && $window.scrollTop() > offset
);

if($window.scrollTop() > offset){
if(lockedFloatVideo == false){
if(playerHasShrunk == false){
playerHasShrunk = true;
ga(‘send’, ‘event’, ‘Brightcove In Article Player’, ‘Player shrunk’, myPlayer.mediainfo.id + ‘|’ + myPlayer.mediainfo.name);

}
jQuery( “.overlay.videoElement” ).css(‘width’, (jQuery(“#article-1 .article-body-content”).width() -jQuery(“.makeVideoticky.video-js”).width()) + ‘px’);
jQuery( “.close_btn.makeVideoticky” ).css(‘margin-left’, (jQuery( “.overlay.videoElement” ).width() + jQuery(“.makeVideoticky.video-js”).width() – 20) + ‘px’);
if(jQuery( “.close_btn.makeVideoticky”).css(“display”) == “none”){
jQuery(“.close_btn.makeVideoticky”).fadeIn();

}

}
}else{
jQuery( “.overlay.videoElement” ).css(‘width’, ‘100%’);
jQuery( “.close_btn.makeVideoticky” ).css(‘margin-left’, ‘0px’);
playerHasShrunk = false;
}

}

if (jQuery(“#article-1 .article-body .brightcoveinlinemarker”).length > 0) {
jQuery(“#article-1 .article-body .brightcoveinlinemarker”).html(jQuery(‘#in-article-video-wrapper’));
} else {
if (jQuery(“#article-1 .article-body > p”).length > 2) {
if(isDesktop){
jQuery(‘#in-article-video-wrapper’).insertAfter(jQuery(“#article-1 .article-body > p:nth-of-type(2)”));
jQuery( function( jQuery ) {
var $window = jQuery( window ); // 1. Window Object.
var $featuredMedia = jQuery( “#featured-media” ); // 1. The Video Container.
var $featuredVideo = jQuery( “.videoElement” ); // 2. The brightCove Video.
var top = $featuredMedia.offset().top; // 4. The video position from the top of the document;
var offset = Math.floor( top + ( $featuredMedia.outerHeight() * 0.5 ) ); //5. offset.
jQuery(‘.in-aricle-video .close_btn’).on(‘click’, function() {
lockedFloatVideo = true;
jQuery($featuredVideo).removeClass(“makeVideoticky”);
jQuery( “.overlay.videoElement” ).css(‘width’, ‘100%’);
ga(‘send’, ‘event’, ‘Brightcove In Article Player’, ‘Player closed’, myPlayer.mediainfo.id + ‘|’ + myPlayer.mediainfo.name);

});

$window.on( “scroll”, function() {
offScrollVideo($window, offset, $featuredVideo);

});

$window.on( “resize”, function() {
offScrollVideo($window, offset, $featuredVideo);
});

} );

}else if (isMobile){
jQuery(‘#in-article-video-wrapper’).insertAfter(jQuery(“#article-1 .article-body > p:nth-of-type(4)”));
}
}

}

myPlayer.on(‘loadstart’, function () {
myPlayer.muted(true);
currentVideoEyebrow = myPlayer.mediainfo.customFields.eyebrow;
if (currentVideoEyebrow === “undefined”) {
currentVideoEyebrow = ”;
} else {
currentVideoEyebrow = ‘

‘ + currentVideoEyebrow + ‘

‘;
}

jQuery(‘#in-article-video-wrapper .overlay’).html(currentVideoEyebrow + ‘

‘ + myPlayer.mediainfo.name + ‘

‘);

if (!isMobile) {
var playlistData = myPlayer.playlist();
for (i = 0; i ‘ + videoItem.customFields.eyebrow + ‘

‘);
}
}

}
}

myPlayer.on(‘loadedmetadata’, function () {

window.onscroll = checkIfVideoInView;

myPlayer.on([‘ads-ad-started’, ‘adserror’, ‘ads-allpods-completed’], function (e) {
if (e.type == ‘ads-ad-started’) {
isAdPlaying = true;
} else {
isAdPlaying = false;
jQuery(“.vjs-playlist.vjs-csspointerevents”).removeClass(“vjs-ad-playing”);
}
});
});

});

});

}
}

Leave a Reply

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.