Showing posts with label YouTube. Show all posts
Showing posts with label YouTube. Show all posts

Monday, 5 March 2012

Play a Playlist using YouTube JavaScript API

If you have been enjoying our <iframe> embed announced back in July we have some good news for you. Starting today, the <iframe> embed code is the default way to share videos on YouTube.com. We are also introducing an initial beta version of the <iframe> embed JavaScript Player API, making it a viable alternative for developers who previously used the API exposed by the ActionScript players. Let’s look at an example of the API usage:

<!DOCTYPE HTML>
<html>
<body>
<div id="player"></div>
<script>
//Load player api asynchronously.
var tag = document.createElement('script');
tag.src = "http://www.youtube.com/player_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var done = false;
var player;
function onYouTubePlayerAPIReady() {
player = new YT.Player('player', {
height: '390',
width: '640',
videoId: 'JW5meKfy3fY',
playerVars: { 'autoplay': 0, 'controls': 1, 'playlist':['your_video_id', '...']},
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
}
function onPlayerReady(evt) {
evt.target.playVideo();
}
function onPlayerStateChange(evt) {
if (evt.data == YT.PlayerState.PLAYING && !done) {
setTimeout(stopVideo, 6000);
done = true;
}
}
function stopVideo() {
player.stopVideo();
}
</script>
</body>
</html>

This example will play a video for several seconds and then stop playback. An instance of YT.Player is used to control the player, defined by script loaded from http://www.youtube.com/player_api .  For more information about the API usage, as always, please consult our Player API documentation and let us know what you think on our Developer Forum.

Pulling in YouTube Videos from Specific Channel

class ChannelFeed {

function __construct($username){
$this->username=$username;
echo $this->username;
$this->feedUrl=$url='http://gdata.youtube.com/feeds/api/users/'.$username.'/uploads?orderby=updated';
$this->feed=simplexml_load_file($url);
}

public function getYTid() {

$ytURL = $this->feed->entry->link['href'];

$ytvIDlen = 11; // This is the length of YouTube's video IDs

// The ID string starts after "v=", which is usually right after
// "youtube.com/watch?" in the URL
$idStarts = strpos($ytURL, "?v=");

// In case the "v=" is NOT right after the "?" (not likely, but I like to keep my
// bases covered), it will be after an "&":
if($idStarts === FALSE)
$idStarts = strpos($ytURL, "&v=");
// If still FALSE, URL doesn't have a vid ID
if($idStarts === FALSE)
die("YouTube video ID not found. Please double-check your URL.");

// Offset the start location to match the beginning of the ID string
$idStarts +=3;

// Get the ID string and return it
$ytvID = substr($ytURL, $idStarts, $ytvIDlen);
return $ytvID;
}

public function showFullFeed(){
$vidarray = array();
foreach($this->feed->entry as $video){
$vidarray[] = $video->link['href'];
}
return $vidarray ;
}


};
$youtube = new ChannelFeed('channel_name');
$vids = $youtube->showFullFeed();
$vidIDs = array_map(array(&$youtube, "getYTid"), $vids);

Friday, 16 December 2011

Delete the background image on YouTube

-log into youtube
-go to your channel
-click 'edit channel'
-click the blue link that says 'channel Design' on the left hand side
-go down to 'background image'
-delete the link from the box
-click 'update channel'

now the background image will no longer display on your youtube channel

 

 

other answer

*Go to "Account" then "Channel Design".

*Under channel design go to "Advanced Design Customization" then click "pick" next to "Background Color". Pick the color black at the very bottom left of the color palate.

*Then under "Repeat Background Image", click "no".

*Save this picture under "My Pictures" on your computer. http://upload.wikimedia.org/wikipedia/commons/thumb/1/1a/Color_icon_black.svg/300px-Color_icon_black.svg.png
*Next to "Background Image" on your "youtube account" page, click "Browse". Save that picture of the image to use as your background.

*Afterwards, you should be able to pick any color off of the "Background Color" option.

I hope this helps...it is kinda confusing, I know, but if you have any questions just let me know. :)
I figured it out on my own.



or



1 -- click on "ACCOUNT▼", ignoring the blue drop-down menu.
(you'll get a new page with black titles and many blue subtitles)

2 -- look on the left for the 3rd black title called "MY CHANNEL"
(you'll see 5 different blue subtitles including "Channel Design"

3 -- click on "CHANNEL DESIGN"
(you'll get a new page with nine colour combinations at the top)

4 -- scroll half-way down and look for "BACKGROUND IMAGE"
(it's the 2nd thin rectangle, with the "Browse" box just beside it)

5 -- simply DELETE THE LINK
(the rectangle should be blank)

6 -- scroll to the top of the page and click "UPDATE CHANNEL"
(it's on the grey stripe just above the nine colour combinations)

Here is the URL address of the YouTube help reference which
most closely answers your question, followed by its direct link:

www . google . com / support / youtube / bin / answer . py ? hl = en & answer = 71515
http://www.google.com/support/youtube/bi…