We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
YouTube Profile Music
Topic Started: Nov 15 2015, 12:23 AM (1,164 Views)
DaPizzaMan
Member Avatar
#TeamSupport

Code Name: YouTube Profile Music

What the code does: Replaces a user-specific code with a YouTube video/profile song.

How to use the code: There are a few options a user has when entering the song(s).
  1. https://www.youtube.com/watch?v=b8OELzmpgZo&list=PL7F37BB1A67E0238D - [YouTube video ID] "&list=" [playlist ID] - all of the bolded needs to be in the profile field.
  2. https://www.youtube.com/watch?v=HitDB-Be_74&index=5&list=PL7F37BB1A67E0238D - [YouTube video ID] "&index=" [video # (in playlist)] "&list=" [playlist ID] - this is the same as the above, but the playlist will start playing at the index/video number.
  3. https://www.youtube.com/watch?v=JxS5E-kZc2s and https://www.youtube.com/watch?v=-UTd98iMBok - when two or more videos are not in a YouTube playlist together, the user can separate the YouTube video ID of each with commas and this code will put them in a playlist together to play on their profile. So for these two videos, they would enter JxS5E-kZc2s,-UTd98iMBok.
  4. Or if you have just one video, entering that video's ID would be enough.


How to install the code: First, you will need to create a custom profile field with "Profile Music" in the name (it can be called anything as long as those two words are in the name) and 1 line text as the type of field. Then, add the following code to Admin CP >> Board Template >> Below the Board
Code:
 
<script type="text/javascript">
var autoplayByDefault = $.zb.get('autoplay_profile_music') === 'true' || false;

if (location.href === main_url + 'home/?c=4') {
$.ajax({url:'http://z4.ifrm.com/30296/128/0/p1170674/YouTubeProfileMusicSettings.js', dataType:'script', cache:true});
} else if (location.href === main_url + 'home/?c=6') {
$.ajax({url:'http://z4.ifrm.com/30296/128/0/p1172914/YouTubeProfileMusicInfo.js', dataType:'script', cache:true});
} else if (location.href.indexOf(main_url + 'profile/') !== -1) {
$.ajax({url:'http://z4.ifrm.com/30296/128/0/p1170675/YouTubeProfileMusicProfile.js', dataType:'script', cache:true});
}
</script>
Change false at the end of the first line to true if you want autoplay to be enabled by default; otherwise, leave it as it is.

Extra notes: Currently, a user can turn off autoplay by going to Preferences >> Board Settings >> Autoplay Profile Music and unchecking the checkbox. That will disable autoplay from all profiles for that user. Their choice takes precedence over the global default set by the autoplayByDefault variable.

I'm sure the explanation of how this code works is a bit confusing, so feel free to ask if you don't understand. I apologize about that. I couldn't find a good way to explain it. If you have any problems or questions, please post in this topic.
Edited by DaPizzaMan, Aug 30 2016, 09:28 PM.
Offline Profile Quote Post Goto Top
 
zbug
Member Avatar
Galaxy Friend
[ *  *  * ]
Sweet! Thanks :)
Offline Profile Quote Post Goto Top
 
.Esper
Member Avatar
x
[ *  *  *  *  * ]
Thank you very much DPM, this is very nice and the all the options are helpful. We are already using it. :up:
Edited by .Esper, Nov 15 2015, 02:32 AM.
Offline Profile Quote Post Goto Top
 
DaPizzaMan
Member Avatar
#TeamSupport

I'm glad everyone likes it. I am thinking about adding next video and previous video buttons beside the play/pause button. I'll probably work on that today or tomorrow.
Offline Profile Quote Post Goto Top
 
DaPizzaMan
Member Avatar
#TeamSupport

Added the buttons for previous and next video. Also updated the variable at the top of the code. So, please update the variable. It'll fix an issue with the code.
Offline Profile Quote Post Goto Top
 
Mortius
Member
[ * ]
hi, for me it keeps saying that an error occured with the video, don't know if this is a code thing, or not. I tried the mini share code too but same deal

nevermind, i'm a dumba** and figured out what i was doing wrong. Thanks for the code :)
Edited by Mortius, Nov 18 2015, 11:46 AM.
Offline Profile Quote Post Goto Top
 
DaPizzaMan
Member Avatar
#TeamSupport

I've added something to the code so that when you go to add the music to your profile through your preferences, you can open up a spoiler that shows examples of how to add the music (for example, you can choose a single video, multiple individual videos, a playlist, or a playlist from a set index).

However, for this update you'll need to copy and paste the new code from the first post to your board again (don't worry, the profile songs will not be lost!).
Offline Profile Quote Post Goto Top
 
The Matt Reptar
Member
[ * ]
I'm having an issue where unless it's set to autoplay, it doesn't work. If autoplay is disabled, and you click play, nothing happens.

Also, is there anyway to have the whole video show instead of a little bar? Or is that a limitation of the profile field being set to one line?
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · ZetaBoards Codes & Modifications · Next Topic »
Add Reply