Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var title = "";
- function yttitle(videoId) {
- title = "";
- var url = "https://www.googleapis.com/youtube/v3/videos?part=id%2C+snippet&id=" + videoId.toString() + "&key=AIzaSyAw0I_XVk99VazLN8-OfKCS7NJinoR_f-Y";
- $.get("https://www.googleapis.com/youtube/v3/videos?part=id%2C+snippet&id=" + videoId + "&key=AIzaSyAw0I_XVk99VazLN8-OfKCS7NJinoR_f-Y", function (data) {
- title = data.items[0].snippet.title;
- show = false;
- });
- }
- var firstTime = true;
- $('.music-form a').click(function () {
- var btn = this;
- if (firstTime) {
- yttitle($(btn).attr('id').toString());
- function doStuff() {
- if (title == "") {
- setTimeout(doStuff, 50);
- return;
- } else {
- $('.music-player').slideUp(function () {
- $('.music-player').html('<iframe width="560" height="315" src="https://www.youtube.com/embed/' + $(btn).attr('id') + '?rel=0&autoplay=1" frameborder="0" allowfullscreen></iframe> \n <marquee direction="left" behavior="scroll">' + title + '</marquee>');
- $('.music-player').slideDown();
- });
- }
- }
- doStuff()
- firstTime = false;
- } else {
- yttitle($(btn).attr('id').toString());
- function doStuff() {
- if (title == "") {
- setTimeout(doStuff, 50);
- return;
- } else {
- $('.music-player').fadeOut(function () {
- $('.music-player').html('<iframe width="560" height="315" src="https://www.youtube.com/embed/' + $(btn).attr('id') + '?rel=0&autoplay=1" frameborder="0" allowfullscreen></iframe> \n <marquee direction="left" behavior="scroll">' + title + '</marquee>');
- $('.music-player').fadeIn();
- });
- }
- }
- doStuff();
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement