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

Truebook replied to ⚡JFarrow⌁'s discussion
Ning Creators Sound Off: Share Your Network
"Ok I just changed my name to truebook.co.uk 
please take a look at let me know what you think and…"
yesterday
KAMALAVIATION TOURS updated their profile
Friday
Truebook replied to ⚡JFarrow⌁'s discussion
Ning Creators Sound Off: Share Your Network
"Please can anyone help my site truebook.site is down for some reason 
trid to contact Ning and even…"
Tuesday
Truebook posted a discussion
Why is my site down ?
Tuesday
Truebook posted a discussion
Apr 20
Truebook replied to ⚡JFarrow⌁'s discussion
Ning Creators Sound Off: Share Your Network
"Hi I am new here 
this is my site 
please give me some ideas 💡 
https://truebook.ning.com"
Apr 18
Eva liked ⚡JFarrow⌁'s discussion Ning Creators Sound Off: Share Your Network
Apr 18
Truebook replied to ⚡JFarrow⌁'s discussion
Ning Creators Sound Off: Share Your Network
Apr 18
Truebook is now a member of Ning Creators Social Network
Apr 18
scott claxton updated their profile
Apr 9
Rhonda liked ⚡JFarrow⌁'s discussion Ning Creators Sound Off: Share Your Network
Mar 27
⚡JFarrow⌁ updated their profile photo
Mar 24
More…

Meanwhile, you can check our social media channels