You are on page 1of 2

16:16 08/07/2020

https://www.tutorialspoint.com/html/html_forms.htm
https://codegena.com/auto-embed-latest-video-youtube-channel/
http://www.htmlinstant.com/ [run codes here]
--------------------------------------------------
cid = Channel ID
vnum = 0 = latest video.
vnum = 1 = second latest video and so on.
autoplay = 0 = autoplay off
autoplay = 1 = autoplay on
?rel=1 = suggested videos related to my channel

16:01 11/07/2020 DJB.


----------------------------------------------------
<iframe class="latestVideoEmbed" vnum='0' cid="UClrjBl3Kfqk1tjosIRztGfQ"
width="600" height="340" frameborder="0" allowfullscreen></iframe>

<iframe class="latestVideoEmbed" vnum='1' cid="UClrjBl3Kfqk1tjosIRztGfQ"


width="600" height="340" frameborder="0" allowfullscreen></iframe>
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>
var reqURL = "https://api.rss2json.com/v1/api.json?rss_url=" +
encodeURIComponent("https://www.youtube.com/feeds/videos.xml?channel_id=");
function loadVideo(iframe) {
$.getJSON(reqURL + iframe.getAttribute('cid'),
function(data) {
var videoNumber = (iframe.getAttribute('vnum') ?
Number(iframe.getAttribute('vnum')) : 0);
console.log(videoNumber);
var link = data.items[videoNumber].link;
id = link.substr(link.indexOf("=") + 1);
iframe.setAttribute("src", "https://youtube.com/embed/" + id + "?
controls=0&autoplay=0?rel=1");
}
);
}
var iframes = document.getElementsByClassName('latestVideoEmbed');
for (var i = 0, len = iframes.length; i < len; i++) {
loadVideo(iframes[i]);
}
</script>

-----------------------------------------------------------------------------------
----
https://www.digitalbard.com/how-to-stop-unrelated-videos-from-showing-up-at-the-
end-of-your-youtube-video/

Here’s how to add the rel parameter and where:

Under the video you want to post to your website, you will select “Share” >
then “Embed.” This generates the html code that you need to place a video on your
website.
Copy and paste into your website source code, where you want the video to
display.
Now modify the code by adding “?rel=0” after the source URL, as in
src=”//www.youtube.com/embed/ABcDEfGHiJklm?rel=0″
And presto, bingo – now only your channel’s videos will be offered after a viewing.
-----------------------------------------------------------------------------------
------------
sort by most popular
https://www.youtube.com/channel/UClrjBl3Kfqk1tjosIRztGfQ/videos?
view=0&sort=p&flow=grid

<iframe width="600" height="340"


src="https://www.youtube.com/channel/UClrjBl3Kfqk1tjosIRztGfQ/videos?
view=0&sort=p&flow=grid?controls=0&autoplay=0?rel=1">
</iframe>
-----------------------------------------------------------------------------------
-----------------
https://developers.google.com/youtube/youtube_subscribe_button

<script src="https://apis.google.com/js/platform.js"></script>

<div class="g-ytsubscribe" data-channelid="UClrjBl3Kfqk1tjosIRztGfQ" data-


layout="default" data-theme="dark" data-count="default"></div>
---------------------------------------------------------------------------
Subscribe to channel
This sample subscribes the active user to the GoogleDevelopers YouTube channel,
specified by the channelId.

/**
* This sample subscribes the active user to the GoogleDevelopers
* YouTube channel, specified by the channelId.
*/
function addSubscription() {
// Replace this channel ID with the channel ID you want to subscribe to
var channelId = 'UClrjBl3Kfqk1tjosIRztGfQ';
var resource = {
snippet: {
resourceId: {
kind: 'youtube#channel',
channelId: channelId
}
}
};

try {
var response = YouTube.Subscriptions.insert(resource, 'snippet');
Logger.log(response);
} catch (e) {
if(e.message.match('subscriptionDuplicate')) {
Logger.log('Cannot subscribe; already subscribed to channel: ' + channelId);
} else {
Logger.log('Error adding subscription: ' + e.message);
}
}
}
-------------------------------------------------------------------
<iframe src=”http://www.youtube.com/subscribe_widget?p=Full_French”
style=”overflow: hidden; height: 105px; width: 300px; border: 0;” scrolling=”no”
frameBorder=”0″></iframe>

You might also like