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

Pam Givens replied to Pam Givens's discussion
Landing Page
"What I meant to say, if I could spell:
I've attempted to create a landing page and have't had much…"
Dec 12
Pam Givens posted a discussion
I've attempted to crate a landing page and have't had much success.  I'd rather have one on my…
Dec 12
Luxury Residences updated their profile
Dec 6
Asumi Carol updated their profile
Dec 2
Shada Hotel updated their profile
Nov 29
Howard Sands replied to Mark Thorpe's discussion
NING is broken?
"I am not a techie, I don't understand the first thing about it, but have a HUGE problem with Ning…"
Nov 27
Howard Sands replied to Donna MacShoe's discussion
Ning Support phone number for my 20 yr old site
"I hope this helps
Ning  https://www.ning.com/contact-us/
1-855-233-6436 (USA/Canada Toll Free)…"
Nov 27
Donna MacShoe posted a discussion
I am completely locked out of my NING site that I have had for 20 years.  ladiesofthehat.org.  When…
Nov 27
Joven left a comment on Ning Networks en español
"Zzz..."
Nov 26
Ron updated their profile
Nov 25
Ron updated their profile photo
Nov 24
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…
Nov 20
More…

Meanwhile, you can check our social media channels