Playing YouTube music

Do you want to share WYSIWYG Web Builder tips, tricks, tutorials or useful HTML code? You can post it here...
(no questions or problems please, this section is not monitored by support).
Forum rules
This section is to share tips, tricks and tutorials related to WYSIWYG Web Builder.
Please do not post questions or problems here. They will not be answered.

PLEASE READ THE FORUM RULES BEFORE YOU POST:
viewtopic.php?f=12&t=1901
Post Reply
User avatar
alex4orly
 
 
Posts: 530
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Playing YouTube music

Post by alex4orly » Mon Nov 13, 2017 8:09 am

I have been working on this idea for a while, now that it is completed I am sharing it with you, in case anyone needs it and will be happy to get your feedback. Have a look at the following URL: http://www.beleuramyhome.org.au/musicclips.html

This HTML page is the front end for the engine. It has a Layout grid in 3 parts, each has an IFrame in it
Each iFrame loads a Blog Object
Each Item in the blog points to an external URL and passes into it a parameter which is the YouTube Clip / VIDEO ID
The code for the engine itself is all in Javascript and using the YouTube API...

Enjoy

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>music</title>
<meta name="generator" content="WYSIWYG Web Builder 12 - http://www.wysiwygwebbuilder.com">
<link href="MasterFrame.css" rel="stylesheet">
<link href="music.css" rel="stylesheet">
</head>
<body>
<div id="ytplayer"></div>
<script>

var YTautostart = '1';
function GetURLParameter(sParam)
{
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++)
{
var sParameterName = sURLVariables.split('=');
if (sParameterName[0] == sParam)
{
//return sParameterName[1];
return decodeURIComponent(sParameterName[1]);
}
else
{ // default clip - Andre Rieu
YTautostart = '1';
return "7UFmwArST-I";
}
}
}

var YTclip = GetURLParameter('clip');

// Load the IFrame Player API code asynchronously.
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/player_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

// Replace the 'ytplayer' element with an <iframe> and
// YouTube player after the API code downloads.
var player;
function onYouTubePlayerAPIReady()
{
player = new YT.Player('ytplayer',
{
height: '80',
width: '400',
frameborder: '2',
playerVars: {autoplay:1, rel:0, fs:0},
videoId: YTclip
});
}
</script></body>
</html>

User avatar
BaconFries
 
 
Posts: 4425
Joined: Thu Aug 16, 2007 7:32 pm

Re: Playing YouTube music

Post by BaconFries » Mon Nov 13, 2017 8:16 am

Is this is to show or ask for opinions of your site maybe how to improve or what needs changing or are you providing a tip if it is a tip then please post at the following:
viewforum.php?f=26

gano101
 
 
Posts: 17
Joined: Fri Jul 21, 2017 5:36 pm

Re: Playing YouTube music

Post by gano101 » Mon Nov 13, 2017 9:19 am

as a music playing site, it works very well.

there's not a lot going on while the music is playing, perhaps you could have a slide show in the background or even have the youtube video play full-screen in the BG.

if I'm being honest, I don't see why somebody wouldn't just go to youtube :?:

User avatar
alex4orly
 
 
Posts: 530
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Playing YouTube music

Post by alex4orly » Mon Nov 13, 2017 11:08 am

Baconfries, it is just a tip. How do I move the post then?

Regarding "why somebody wouldn't just go to youtube..." this website is for my retirement village, mid 70's ++ computer literacy is almost non existant... I managed to get some of them (around 80 out of 400 residents) to visit the website and let them ask for functionality, this music player was just a recent request. To you and I, going to YouTube and doing a search for Frank Sinatra is very clear... for them it is not

Cheers

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests