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

Alex - Rosas † Negras replied to Suave's discussion
I AM LOOKING FOR DEVELOPER ASSISTANCE WITH ADDING AUTOMATIC MUSIC TO MY HOME PAGE
"if you need I'm here, if you look in my discussions you will also find the playstil"
5 hours ago
Alex - Rosas † Negras replied to ⚡JFarrow⌁'s discussion
What is going on with Ning? What Do We have to Look Forward To?
"Bizz ⚡JFarrow⌁ 
I'm sorry that many like us have worked so hard and given up, but at least I'm…"
5 hours ago
⚡JFarrow⌁ posted a discussion
Back in the day, this community was jumping with activity.   But since the Ukraine war broke out we…
13 hours ago
⚡JFarrow⌁ and Truebook are now friends
13 hours ago
Alex - Rosas † Negras replied to Alex - Rosas † Negras's discussion
I want to thank JOHN BIZLEY ( BIZZ) for his invaluable help, active icons on the Ning bar,CODES ADDED
"A thousand thanks"
Tuesday
Alex - Rosas † Negras replied to Pam Givens's discussion
Landing Page
"Pam Givens this is an example i created of an old 3.0 site"
Tuesday
Alex - Rosas † Negras replied to Pam Givens's discussion
Landing Page
""
Tuesday
Alex - Rosas † Negras replied to Alex - Rosas † Negras's discussion
Sorry for my absence
"Pam Givens hi my friend, yes everything is ok a big hug"
Monday
Alex - Rosas † Negras replied to ⚡JFarrow⌁'s discussion
Ning Creators Sound Off: Share Your Network
"⚡JFarrow⌁  hi my bro! the situation is sad, Biz and all the programmers are missing, once we all…"
Monday
Alex - Rosas † Negras and Truebook are now friends
Monday
Melissa V updated their profile
May 7
conversor de letras updated their profile
May 7
More…

Meanwhile, you can check our social media channels