Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YouTube #160

Open
drewtoma opened this issue Feb 18, 2016 · 7 comments
Open

YouTube #160

drewtoma opened this issue Feb 18, 2016 · 7 comments

Comments

@drewtoma
Copy link

Any interest in adding YouTube support?

@iamtchelo
Copy link

This is a good ideia @tomagig

@FranzLulu
Copy link

Actually it's quite simple to add youtube if you have a youtube channel.

First you have to duplicate the RSS part in the jquery.socialfeed.js file (or simply remplace every 'rss' string with 'youtube'if you don't use the RSS functionality).

Then still in the JS file replace in the utility section of the youtube part

post.author_picture = '';
with this
post.author_picture = 'imageofyourchoice.jpg';

Where imageofyourchoice.jpg is the URL of your Logo for instance

Then replace

if (options.show_media && item.thumbnail !== undefined ) {
           post.attachment = '<img class="attachment" src="' + item.thumbnail.url + '" />';
} 

with this

var str = item.id;
var idVideo = str.replace("yt:video:", "");
post.attachment = '<div class="video-container"><iframe type="text/html" width="560" height="349" src="https://www.youtube.com/embed/' + idVideo + '" frameborder="0" allowfullscreen></iframe></div>';

You can change of course the with and height of your choice.

Then in the index.html where you call the other social network simply add

youtube:{
               urls: ['https://www.youtube.com/feeds/videos.xml?user=yourUser'], //Array: Specifiy a list of youtube feed from which to pull posts
           limit: 10  //Integer: max number of posts to load for each url
 },

Where yourUser is the name of your channel.

Finally if you want to make your video responsive add this in your CSS

.video-container {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px;
height: 0;
overflow: hidden;
}
.video-container iframe,
.video-container object,
.video-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

Hope that helps ;-)

@mrmoonlv
Copy link

@FranzLulu maybe create pull request?

@vojtasvoboda
Copy link

PR sent and tested #166

@h-sobhy
Copy link

h-sobhy commented Jun 18, 2016

It works @FranzLulu .. 1 min. implementation.

@FranzLulu
Copy link

Glad to hear it ;-)

@iamtchelo
Copy link

I'm using the V3 Youtube API in this repository - https://github.com/marcelodeveloper/angularjs-youtube

The youtube response is very simple, case you get more infos from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants