Author Topic: Re: [SVN ULX/ULib only] YouTube music player (UPDATED: June 26th, 2012)  (Read 88691 times)

0 Members and 1 Guest are viewing this topic.

Offline RynO-SauruS

  • Jr. Member
  • **
  • Posts: 77
  • Karma: 17
NOTICE
This addon is broken because I haven't updated it for GMod 13, and I'm sorry to say that I've dropped development on it.



YouTube music player by RynO-SauruS


This ULX module allows players to play music from YouTube (the audio from any YouTube video) on the server.


Features:

Client-side GUI player controls (Volume, mute/unmute, shows current time in song/song length):

   

    Note: the button with the arrows does nothing.

    UPDATE 1.1: The button with the arrows AND the pause/play button have been removed.
    (this is so different clients' position in the song will stay synced with each other, and to keep the player from being auto-hidden before the song is over)
    Also updated with 1.1, the controls are no longer visible when a video isn't playing, and it fades in and out, nice and pretty.



Play videos with a ULX command (<url> argument should be a link to any YouTube video, command is by default admin-only):

    Console: ulx playvid <url>
    Chat: !playvid <url>


New with 1.1:

    Play videos client-side with a ULX command (<url> argument should be a link to any YouTube video, and by default, anyone can use this):

        Console: ulx playvidcl <url>
        Chat: !playvidcl <url>


    Automatically plays in HD (high quality) if the video supports it
    UPDATE 1.1: You can now set the quality manually. (see CVars section)

    Works with videos that have embedding disabled

    Prints the URL and title of the YouTube video in the chat when you play it


Command to stop the video that's playing for all clients (by default, admin-only):

    Console: ulx stopvid
    Chat: !stopvid

    UPDATE 1.1 (changed command name!):
    Console: ulx stopvidall
    Chat: !stopvidall


Command to stop the video client-side (for the player who types it), if a player doesn't want to hear the video (by default, anyone can use this):

    Console: ulx stop
    Chat: !stop

    UPDATE 1.1 (changed command name!):
    Console: ulx stopvid
    Chat: !stopvid


New with 1.1:

Playlist, allows you to save videos to the server and play them later, with a nice little music menu.


    Image:
   


    "music" command:

        Console: ulx music
        Chat: !music

        Opens the music menu, allowing you to play videos saved on the server.


    "savevid" command:

        Console: ulx savevid <url>
        Chat: !savevid <url>

        Saves the specified video to the server's playlist.


    "savecurvid" command:

        Console: ulx savecurvid
        Chat: !savecurvid

        Saves the currently playing video to the server's playlist.


    "removevid" command:

        Console: ulx removevid <url>
        Chat: !removevid <url>

        Removes a video on the server's playlist.


    "renamevid" command:

        Console: ulx renamevid <url> <new title>
        Chat: !renamevid <url> <new title>

        Renames a video on the server's playlist.

CVars:

    CVar "ulx_songplayer_enable", enabled/disables the music player client-side. (default = "1", enabled)


    CVar "ulx_songplayer_quality", sets the quality of videos client-side. (default = "large", 480p)

        Possible values: "small" = 240p, "medium" = 360p, "large" = 480p, "hd720" = 720p, "hd1080" = 1080p, "highres" = highest quality


Requirements:

Latest ULX and ULib (SVN versions!)


Installation (Scroll down for SVN!):

Extract the attached .rar file to garrysmod/addons.


Changelog:

Code: [Select]

UPDATE 1.41:
-Removed: Debug messages ("Status:", etc.).. Sorry for that.

UPDATE 1.4:
=Fixed: Again, videos not playing since a YouTube update.. and it shouldn't break this time!

UPDATE 1.3:
=Fixed: Videos not playing since the YouTube interface update.. Sorry this took so long!

UPDATE 1.2:
+Addition: "Play for all" and "Play client-side" options to the playlist right-click menu.
*Change: Changed some file names to reflect the current official name of this addon (it was initially called "ULX SongPlayer"). IMPORTANT: This means you MUST remove the folder for the old version before installing this one!
*Change: The shared code is a LOT more clean and efficient, thanks to Megiddo's new logging system.

UPDATE 1.1:
+Addition: A playlist feature has been added! Save a video to the server's playlist with "ulx savevid <url>" (console) or "!savevid <url>" (chat), or save the currently playing video with "ulx savecurvid" (console) or "!savecurvid" (chat), and play saved music by opening the music menu with "ulx music" (console) or "!music" (chat).
+Addition: Added a new ULX command, "ulx playvidcl <url>" (console), "!playvidcl <url>" (chat), plays a video CLIENT-SIDE. By default, anyone can use this.
+Addition: Added 2 client-side CVars, "ulx_songplayer_enable" (enables/disables the music player client-side), and "ulx_songplayer_quality" (sets the quality of videos client-side)
Possible values: "small" = 240p, "medium" = 360p, "large" = 480p, "hd720" = 720p, "hd1080" = 1080p, "highres" = highest quality
*Change: The player controls now automatically hides itself when a video is not playing, with a nice fade in/out.
*Change: Changed the "stop" command (stops video client-side) to "stopvid", and therefore changed the old "stopvid" (stops video for everyone) to "stopvidall".
=Semi-fix: DRASTICALLY reduced the frequency of client crashes (almost never crashes now) when playing or stopping a video.

UPDATE June 26th, 2012 - SVN created. Checkout link:
http://ulx-youtube-jukebox.googlecode.com/svn/trunk/ (EDIT: link fixed, sorry)

Installation instructions:
Install Tortoise SVN (Download) if you haven't already, create a folder in your "garrysmod/garrysmod/addons" folder named "ULX_YouTube_Jukebox" or whatever you want, then right-click the new folder and select "SVN Checkout...", paste the checkout link I've posted above, and click OK.

Special thanks to:

Megiddo, for answering various questions of mine through Steam PM.
HellFox, for his advice/assistance on this, and giving me some ideas for things, including the "video debug" feature.  :)
« Last Edit: March 19, 2013, 07:54:18 PM by RynO-SauruS »


YouTube music player by RynO-SauruS

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Re: [SVN ULX/ULib only] YouTube music player (UPDATED: June 26th, 2012)
« Reply #1 on: October 19, 2010, 09:09:20 AM »
Glad you decided to release this Ryno! Hopefully I helped you over Steam more than I confused you. ;)
Experiencing God's grace one day at a time.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Re: [SVN ULX/ULib only] YouTube music player (UPDATED: June 26th, 2012)
« Reply #2 on: October 19, 2010, 04:25:40 PM »
Yay! Awesome!
Now Stickly man can direct me to nice Trance tunes while I'm coding Gmod and I won't have to switch screens to input the URL.
Shame I rarely have urge to code much anymore.
:P
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline RynO-SauruS

  • Jr. Member
  • **
  • Posts: 77
  • Karma: 17
Re: Re: [SVN ULX/ULib only] YouTube music player (UPDATED: June 26th, 2012)
« Reply #3 on: October 19, 2010, 04:54:00 PM »
Thanks!  ;D


YouTube music player by RynO-SauruS

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: Re: [SVN ULX/ULib only] YouTube music player (UPDATED: June 26th, 2012)
« Reply #4 on: October 19, 2010, 06:32:21 PM »
Very nice! ;D

Definitely a much better alternative from the full 3D youtube players and such when using it just for music!

Just a few suggestions from me though--

Are the controls supposed to be visible even when there is no song playing? If plausible, you should make it hidden while paused, or maybe even implement a clientside bind/chat command to show/hide it.

Also, perhaps you should consider using the command "ulx playvid stop" or something to that effect instead of "ulx stop" because if admins/users come across the "ulx stop" command in their help, or in XGUI or something, they may be initially confused as to what it does.

Other than that, excellent work! :D

(Oh btw JamminR, I heard this really awesome song the other-- Nevermind, I should wait until you're very very busy and on steam chat before I bug you with more tunes :P)
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6

Offline RynO-SauruS

  • Jr. Member
  • **
  • Posts: 77
  • Karma: 17
Re: Re: [SVN ULX/ULib only] YouTube music player (UPDATED: June 26th, 2012)
« Reply #5 on: October 19, 2010, 10:48:04 PM »
Thank you!


YouTube music player by RynO-SauruS

Offline RynO-SauruS

  • Jr. Member
  • **
  • Posts: 77
  • Karma: 17
Re: Re: [SVN ULX/ULib only] YouTube music player (UPDATED: June 26th, 2012)
« Reply #6 on: November 20, 2010, 09:13:50 PM »
Big update!

Code: [Select]
UPDATE 1.1:
+Addition: A playlist feature has been added! Save a video to the server's playlist with "ulx savevid <url>" (console) or "!savevid <url>" (chat), or save the currently playing video with "ulx savecurvid" (console) or "!savecurvid" (chat), and play saved music by opening the music menu with "ulx music" (console) or "!music" (chat).
+Addition: Added 2 client-side CVars, "ulx_songplayer_enable" (enables/disables the music player client-side), and "ulx_songplayer_quality" (sets the quality of videos client-side)
Possible values: "small" = 240p, "medium" = 360p, "large" = 480p, "hd720" = 720p, "hd1080" = 1080p, "highres" = highest quality
*Change: The player controls now automatically hides itself when a video is not playing, with a nice fade in/out.
*Change: Changed the "stop" command (stops video client-side) to "stopvid", and therefore changed the old "stopvid" (stops video for everyone) to "stopvidall".
=Semi-fix: DRASTICALLY reduced the frequency of client crashes (almost never crashes now) when playing or stopping a video.
« Last Edit: November 20, 2010, 09:21:58 PM by RynO-SauruS »


YouTube music player by RynO-SauruS

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Re: [SVN ULX/ULib only] YouTube music player (UPDATED: June 26th, 2012)
« Reply #7 on: November 21, 2010, 12:20:09 AM »
Some nice updates there Ryno.

How does your play for all work? Does it load the script locally for them?
(Sorry, I've not actually looked at the code/used it)

I may have enhancement suggestion depending on how you do it already.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline RynO-SauruS

  • Jr. Member
  • **
  • Posts: 77
  • Karma: 17
Re: Re: [SVN ULX/ULib only] YouTube music player (UPDATED: June 26th, 2012)
« Reply #8 on: November 21, 2010, 06:37:22 AM »
The server sends a usermessage to all clients connected, and when they receive the usermessage, their client loads a small block of HTML code in an HTML frame (which has player controls).


YouTube music player by RynO-SauruS

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Re: [SVN ULX/ULib only] YouTube music player (UPDATED: June 26th, 2012)
« Reply #9 on: November 21, 2010, 10:47:48 AM »
Ah ok. I'd figured that was playing locally.

Few ideas to get some more thought process going. :D

Perhaps add a way to play to an individual or individuals?
Doing it in 'standard' ULX style would require you move some parameter/variables around in passing to functions.
ulx playvid <player(s)> <url>
Those who use it now would have to get used to it, using ^ for themselves, but would allow admins a bit more control if you wrote that in.

To me, Playvid seems like it would be better served by those with special access/admin privileges.
I wouldn't want a player interjecting on each other on a server I'd run.
So, what about playvidlocal for clients side only?
Write in additional code that allows players to play stuff they want locally. Stored locally on thier machine.
Make there own playlist perhaps, make a separate menu, whatever, yet still allow playing stuff from the server.
If you wanted to get really complicated, allow a client option to 'suggest for server' that would allow server admins to see suggestions for the server/approve later.
Or some type of share command. One player plays non-server stored song. Makes comment to others about how awesome it is and to explain why he's bunny hopping around the map. :P
Others ask to hear it. Player listening runs sharevid <player(s)> <url> and the other players don't get forced to play it, but script asks them if they want to listen.

Ok. That's enough to get your mind going for now. Some of that now that I look back seems to complicate it (ULX Motto, striving for simplicity), but thinking you might find nice
compromises.

These mind stream of thoughts brought to you by The Glitch Mob - How to Be Eaten by a Woman
(Though they have a few good ones I've been jamming (see, see, "Jammin"R) to last night and this morning, that one was cranked while writing the above.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline RynO-SauruS

  • Jr. Member
  • **
  • Posts: 77
  • Karma: 17
Re: Re: [SVN ULX/ULib only] YouTube music player (UPDATED: June 26th, 2012)
« Reply #10 on: November 21, 2010, 12:30:13 PM »
Aw man! I was wondering why you didn't seem to know about the "ulx playvidcl" command! This is something I also added with 1.1.
Then I realized.. I forgot that pre-1.1 didn't have it, so I didn't think to mention it in the update news. Whoops! I'll update that now. ;)
« Last Edit: November 21, 2010, 12:32:49 PM by RynO-SauruS »


YouTube music player by RynO-SauruS

Offline StanTheMan

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Re: Re: [SVN ULX/ULib only] YouTube music player (UPDATED: June 26th, 2012)
« Reply #11 on: December 20, 2010, 05:43:50 PM »
Hi there!

Is it possible to hide that "play bar".
People said its gettin realy annoying after a while.  :o

Stan

Offline RynO-SauruS

  • Jr. Member
  • **
  • Posts: 77
  • Karma: 17
Re: Re: [SVN ULX/ULib only] YouTube music player (UPDATED: June 26th, 2012)
« Reply #12 on: January 08, 2011, 08:22:06 PM »
Hi there!

Is it possible to hide that "play bar".
People said its gettin realy annoying after a while.  :o

Stan

Hi!

Sorry I took so long to respond. I made it auto-hide the player bar when a song is playing in the latest version, you just need to update.
The download link is in the first post.
« Last Edit: January 08, 2011, 08:27:28 PM by RynO-SauruS »


YouTube music player by RynO-SauruS

Offline Ronin

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: Re: [SVN ULX/ULib only] YouTube music player (UPDATED: June 26th, 2012)
« Reply #13 on: February 13, 2011, 03:35:26 PM »
I'd want to report a bug whereas when the music doesn't play for me, but the video is showing the time going through the vid still, and I attempt to stop it, that causes my listen server to crash, and I would expect it to happen for dedicated servers as well probably.  Just something I wanted to address as an issue I am having currently. 

EDIT:  Not necessarily crash, but freezes my game, and always ending up where I have to ctrl-alt-delete myself out of it, I'll try to let it stay and see what happens, if the client-side disconnect time gets reached, then that's the real issue.

Other than that, I truly love this dude :D
« Last Edit: February 13, 2011, 03:37:37 PM by Ronin »

Offline RynO-SauruS

  • Jr. Member
  • **
  • Posts: 77
  • Karma: 17
Re: Re: [SVN ULX/ULib only] YouTube music player (UPDATED: June 26th, 2012)
« Reply #14 on: August 07, 2011, 07:40:28 PM »
Here's "two" updates! (I actually coded 1.2 several months ago, and somehow forgot to post it :-[)

Important: You MUST remove the folder for the old version before installing this one!

Code: [Select]
UPDATE 1.3:
=Fixed: Videos not playing since the YouTube interface update.. Sorry this took so long!

UPDATE 1.2:
+Addition: "Play for all" and "Play client-side" options to the playlist right-click menu.
*Change: Changed some file names to reflect the current official name of this addon (it was initially called "ULX SongPlayer"). NOTE: This means you MUST delete the addon folder for the old version before installing this one!
*Change: The shared code is a LOT more clean and efficient, thanks to Megiddo's new logging system.


YouTube music player by RynO-SauruS