Current status of the Ning Platform is always available on the Ning Status Blog.

Playing Videos In Activity Feed Tip

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 :-)

You need to be a member of Ning Creators Social Network to add comments!

Join Ning Creators Social Network

Votes: 0
Email me when people reply –

Replies

  • NC for Hire

    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

    Activity
    jr-images is a social network
  • 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.

  • NC for Hire

    Thanks Bizz!

This reply was deleted.
 

Some interesting articles related to community management, digital marketing etc. could be found in our digest. Don't hesitate to leave a feedback so we would know that we should continue :-)

Latest Activity

Mark Thorpe posted a discussion
I've run networks based on this platform in the past and never have I seen it in such dissarray as…
yesterday
⚡JFarrow⌁ liked Bizz ( John )'s discussion How To Create Unlinked Pages In Groups Easily
Nov 15
Suave liked Suave's profile
Nov 15
Suave updated their profile photo
Nov 14
Suave updated their profile
Nov 14
Suave liked Suave's discussion I AM LOOKING FOR DEVELOPER ASSISTANCE WITH ADDING AUTOMATIC MUSIC TO MY HOME PAGE
Nov 14
Suave is now a member of Ning Creators Social Network
Nov 14
Chaz is now friends with Kathleen (SunKat) and Margarida Maria Madruga
Nov 13
Mark Thorpe posted a discussion
Hi there,Just setting up a network and wondering how I can get the links that new mmebers fill out…
Nov 13
Fernando Bisbal posted a discussion
There are people whose profile does not show the group block and we do not know which groups they…
Nov 7
Fernando Bisbal posted a discussion
There are people whose profile does not show the group block and we do not know which groups they…
Nov 7
Michael Rua Franco replied to Michael Rua Franco's discussion
Problems with Polyfill.io in my site
"Thank you so much for your reply Vlada "
Nov 6
More…

Meanwhile, you can check our social media channels