I was asked if I could post this tip again so here is the code needed. The tip allows your videos to be played in the activity feed, so when a user clicks on the video it is replaced by the video itself. When a user clicks on the link of the video etc they will still go to the main video page.
You can see an example here : https://jr-images.ning.com/
First we need to add some custom code which goes in your Social Site Manager > Custom Code > End Of Page
<script>
//If videos are iframed then css makes them responsive
x$(document).ready(function() {
if (x$('.videoDetailPage-video iframe').length > 0) {
x$('.videoDetailPage-video').addClass('iframed');
}
});
</script>
<script>
x$(document).ready(function(){
var activityVideoMedia = '.feedEvent-createVideoRollup .activityFeed-content a.media-img,.feedEvent-createVideoLike .activityFeed-content a.activityFeed-image,.feedEvent-createVideoComment .activityFeed-content a.media-img, .feedEvent-createVideoRollup .activityFeed-content a.activityFeed-image,.feedEvent-featureVideo .activityFeed-content a.media-img';
var activityVideoMedia = '.feedEvent-createVideoRollup .activityFeed-content a.media-img,.feedEvent-createVideoLike .activityFeed-content a.activityFeed-image,.feedEvent-createVideoComment .activityFeed-content a.media-img, .feedEvent-createVideoRollup .activityFeed-content a.activityFeed-image,.feedEvent-featureVideo .activityFeed-content a.media-img';
x$('body').on('click', activityVideoMedia, function(e){
e.preventDefault();
var titleURL = x$(this).attr('href');
x$('.activityShowMe-container').remove();
x$('.feedEvent-createVideoLike .activityFeed-content a.activityFeed-image').addClass("media-img");
x$('.activityFeed-content').removeClass('videoActiveContent');
x$('.activityFeed-videos, .eventPage-image-wrapper').removeClass("ActivityvideoActive");
x$(document.body).css({ 'cursor': 'wait'});
x$(activityVideoMedia).slideDown(500);
x$(this).parent().addClass("ActivityvideoActive");
x$('.ActivityvideoActive').closest('.activityFeed-content').addClass('videoActiveContent');
x$(this).parent().append('<div class="activityShowMe-container"><div class="activityShowMe-header"><a class="activityShowMe-closer" title="Close the Video">X</a></div><div class="activityShowMe">Video Loading...</div><div class="activityShowMe-page"><a class="activityShowMe-comment">Comments</a><a class="myTitleLink" title="View In Main Video Page">View In Main Video Page..</a></div></div>');
x$('a.myTitleLink, a.activityShowMe-comment').attr("href", titleURL).appendTo('.activityShowMe-page');
x$('a.myTitleLink, a.activityShowMe-closer, a.activityShowMe-comment').hide();
x$(".activityShowMe").load(x$(this).attr("href") + " .videoDetailPage-video", function() {
if (x$('.videoDetailPage-video iframe').length > 0) {
x$('.videoDetailPage-video').addClass('iframed');
}
x$(".activityShowMe").hide().fadeIn();
x$(document.body).css({ 'cursor': 'default'});
x$('a.myTitleLink, a.activityShowMe-closer, a.activityShowMe-comment').fadeIn();
});
x$('.videoDetailPage-viewVideo').remove();
x$(this).slideUp();
x$('a.activityShowMe-closer').click(function(){
x$('.activityShowMe-container').slideUp("slow", function(){
x$('.activityShowMe-container').remove();
x$(activityVideoMedia).slideDown(500);
x$('.activityFeed-videos, .eventPage-image-wrapper').removeClass("ActivityvideoActive");
x$('.activityFeed-content').removeClass('videoActiveContent');
});
});
});
});
</script>
NEXT we add some css and this goes in your Design Studio Custom CSS
/* Make video Responsive */
.videoDetailPage-video.iframed{
margin-bottom: 5px;
width: 100%;
height: 0;
padding-bottom: 56.25%;
position: relative;
}
.videoDetailPage-video.iframed iframe{
max-width: 100%;
height: 100%;
width:100%;
position: absolute;
}
.activityShowMe-container{clear:both; max-width:1280px; margin-top:10px;margin-bottom:20px;width:100% }
.activityShowMe-header{ width:100%;clear:both;height:40px }
a.activityShowMe-closer{
padding: 4px 8px;
border-radius: 70px;
background-color:white;
color: #cc7474;
cursor: pointer;
font-weight:bold;
float:left;
clear:both;
border: solid 1px darkgray;
}
a.activityShowMe-closer:hover{ background-color:royalblue;text-decoration: none;color:white;font-weight:bold }
.activityShowMe-page a{ display:inline-block; cursor:pointer }
.activityShowMe-page{ margin-top:8px; text-align:right; width:100%;clear:both }
.activityShowMe-page a{ font-size:0.9em }
.activityShowMe .sheet{ padding:10px 0px 0px 0px!important }
a.activityShowMe-comment{ float:left }
.activityShowMe .site-body{ background-color:transparent }
@media only screen and (min-width:300px){
.activityShowMe { font-size:1.5em; }
}
.videos-only .activityFeed-videos { margin-bottom:20px; }
@media only screen and (min-width:771px){
.videos-only .activityFeed-videos:not(:only-child) { margin-bottom:20px;margin-right:5px; max-width:24%; display:inline-block }
}
.ActivityvideoActive{ width:100%!important; max-width:100%!important;clear:both }
.activityFeed-content.videoActiveContent{ max-width:100%!important}
.feedEvent-createVideoRollup .activityFeed-content {
max-width: 100%;
/*Was 548px */
}
.feedEvent-createVideoComment .activityFeed-detailContent{
margin-top:10px;
}
Enjoy, Bizz :-)
Replies
Fantastic tip! Thanks Bizz!
Just noticed I took this out so added it back so it can be seen working. There is a video in activity near the top to view
https://jr-images.ning.com/activity
nice work!
I wonder if is possible to autoplay the videos as well?
Might be able too but youTube added restrictions for the autoplay when embedding. Besides it's not recommended as it's one of the most hated features for videos to autoplay. Will see what can do though.
Thanks Bizz!