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

0 Members and 5 Guests are viewing this topic.

Offline pikkip

  • Newbie
  • *
  • Posts: 27
  • Karma: 1
Re: Re: [SVN ULX/ULib only] YouTube music player (UPDATED: June 26th, 2012)
« Reply #30 on: January 12, 2012, 07:14:03 AM »
uhm it seems to this don't work anymore D= me sad! me dint try it yet! >:(

Offline RynO-SauruS

  • Jr. Member
  • **
  • Posts: 77
  • Karma: 17
Re: Re: [SVN ULX/ULib only] YouTube music player (UPDATED: June 26th, 2012)
« Reply #31 on: January 14, 2012, 11:51:04 AM »
i just installed this, no player box when choosing the song to play and no sound either.

is there a fix for this?

uhm it seems to this don't work anymore D= me sad! me dint try it yet! >:(

Hey folks! Sorry, it seems this has yet again been broken by YouTube updates. I'm currently working on this situation. Sorry I took so long to reply.


Tech-savvy people:
The reason this is happening is because of my rather hackish method of playing the videos, which involves embedding YouTube's .swf flash player directly, rather than using their official "embedded player" (embed code). I was doing it this way because it actually bypassed YouTube's restrictions on some videos, that don't allow them to be embedded.

The problem is, it seems that the location of the .swf file (http://s.ytimg.com/yt/swfbin/watch_as3-vflk8NbNX.swf for example) seems to change alot, and when it does, obviously, it breaks my code.
Does anyone have any ideas of how I might be able to achieve this (play videos that have embedding disabled), and it not be broken with YouTube updates? =/
« Last Edit: January 14, 2012, 07:16:00 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 #32 on: January 14, 2012, 06:06:56 PM »
So, this is even more technical than my general capability, but, I'm good with ideas.
What allows the Youtube actual player code to play that 'embedded' won't.
Is it a encrypted code within the player, or is it just some Youtube server expection (POST/GET blah.swf?I_AM_THE_REAL_THING_BABY!).
If not encrypted within the player...can it be faked?

And, on to next idea if a better answer can't be found to your question and my ideas above.
Use RSS feed/embedded player code for most items. The RSS API is prob less likely to change as often.
Find some way to detect (or at worst, teach human using your functions) if the original didn't play due to 'no embed allowed', have second function run that attempts using the 'Youtube' code.
Though it is just as likely to break if/when Youtube updates again, it's less likely to break ALL of this player. :)
"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 #33 on: January 14, 2012, 06:21:00 PM »
Unfortunately, I haven't the slightest clue what it would take to get the "embedded player" to play videos that have embedding disabled. I suppose it's probably written into the encrypted .swf code to check whether embedding is allowed or not. Because when I play videos by manually embedding the .swf that's used when you play videos on YouTube.com, it doesn't mind whether embedding is enabled or not.


YouTube music player by RynO-SauruS

Offline pikkip

  • Newbie
  • *
  • Posts: 27
  • Karma: 1
Re: Re: [SVN ULX/ULib only] YouTube music player (UPDATED: June 26th, 2012)
« Reply #34 on: January 14, 2012, 06:21:47 PM »
I might got an idea try something like this:

"http://www.youtube.com/watch?v=FEDlSJ-0vr0"

When you use that kind of link... it will use it as something like this:

"<iframe width="560" height="315" src="http://www.youtube.com/embed/FEDlSJ-0vr0?rel=0" frameborder="0" allowfullscreen></iframe>"

also basically where it finds the "http://www.youtube.com/" and uses the other text in another line so it will put in "embed/" and uses that normal youtube code to play the video...

I do not know a lot about this, i am more to e2, HTML5, php, and css3

Hopefully this gave you some ideas ;3

Offline RynO-SauruS

  • Jr. Member
  • **
  • Posts: 77
  • Karma: 17
Re: Re: [SVN ULX/ULib only] YouTube music player (UPDATED: June 26th, 2012)
« Reply #35 on: January 14, 2012, 06:29:14 PM »
Hmm.. I might be able to make it retrieve the location of the .swf automatically from the video page's HTML. Pikkip, I'm not sure if that's what you meant. Could you clarify?


YouTube music player by RynO-SauruS

Offline pikkip

  • Newbie
  • *
  • Posts: 27
  • Karma: 1
Re: Re: [SVN ULX/ULib only] YouTube music player (UPDATED: June 26th, 2012)
« Reply #36 on: January 14, 2012, 06:31:23 PM »
Hmm.. I might be able to make it retrieve the location of the .swf automatically from the video page's HTML. Pikkip, I'm not sure if that's what you meant. Could you clarify?

Uhm... kinda like it finds what is the dirrections, and what is the website...

so it will seperate those 2 to make it put in "embed/" to make it work with the other kind of code i sended you... maybesomething like that or else... its a bit hard to explane

Offline RynO-SauruS

  • Jr. Member
  • **
  • Posts: 77
  • Karma: 17
Re: Re: [SVN ULX/ULib only] YouTube music player (UPDATED: June 26th, 2012)
« Reply #37 on: January 14, 2012, 07:19:48 PM »
Oh, are you just saying play the videos from http://www.youtube.com/embed/ , only in an iframe? I'll try that.

Edit: Nope, playing videos in http://www.youtube.com/embed/ still gives you errors if embedding is disabled. :(

Edit 2: But there is something that seems somewhat promising: http://www.youtube.com/watch_popup?v=97S66xee0U8

The watch_popup page ignores whether embedding is enabled or not. The biggest problem with this is that I can't seem to find a way to make it not hide the player controls. =/ I've tried putting &autohide=0 in the URL (the usual parameter for this, if you're working with the .swf), but sadly it doesn't do anything. =(
« Last Edit: January 14, 2012, 08:59:28 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 #38 on: January 14, 2012, 10:00:07 PM »
While tinkering looking for a way to hide the controls (did ya know there's a Javascript API?? Are you already looking into it?), I found this tidbit.
Might be handy for my 'function 1 for embed allowed, function 2 for non allowed' determination idea.
From http://code.google.com/apis/youtube/player_parameters.html#ExampleUsage
BOLD is my doing -
Quote from: Example Usage
If you are using the YouTube Data API, you can programmatically construct these URLs by retrieving the <yt:videoid> tag value in an API entry and replacing the VIDEO_ID text in the URLs above with that value. You should also confirm that the feed entry for the video contains a <media:content> tag for which the value of the yt:format attribute is 5. The absence of that tag indicates that the video owner had disabled embedding for the video.

EDIT - Ryno, the popup video link you included in previous post, 97S66xee0U8 ... does it allow embedding?
If not, using http://code.google.com/apis/youtube/youtube_player_demo.html and pasting in that on the right "load or cue video" field, allows it to play using the javascript API.
This MIGHT be because its hosted on the Google domain, but, worth looking into, maybe.
Now that I think about it, gmod html doesn't allow javascript, does it.
Ah well...still has brain cells burning
« Last Edit: January 14, 2012, 10:09:18 PM by JamminR »
"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 #39 on: January 14, 2012, 11:26:25 PM »
It uses the YouTube Data API to retrieve the video name and length.  :) And you're right, using the API, it would be relatively simple to determine whether or not embedding is enabled.

As for the popup link, no, that video doesn't allowing embedding because it's from VEVO. Look: http://www.youtube.com/v/97S66xee0U8?autoplay=1
If only autohide=0 worked on that! :'(


Edit: If worse comes to worst, I'll simply use the official embedded player, and implement playback error messages based on info in the YouTube Data API. Then atleast it'll be stable.
« Last Edit: January 14, 2012, 11:42:07 PM by RynO-SauruS »


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 #40 on: March 28, 2012, 01:26:14 PM »
Update! (1.4) Too lazy to make a full changelog right now. :P I will note that I've fixed videos not playing (sorry for this), and have retained the ability to play videos that have embedding disabled. =)
Also, it shouldn't break this time!

Edit: Uploaded 1.41, removes the "Status:" debug messages I forgot to remove...
« Last Edit: March 28, 2012, 01:59:31 PM by RynO-SauruS »


YouTube music player by RynO-SauruS

Offline ViktorK

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: Re: [SVN ULX/ULib only] YouTube music player (UPDATED: June 26th, 2012)
« Reply #41 on: March 31, 2012, 07:58:31 AM »
Hi,
this is awesome addon, thanks for fix! :)
BTW. How about add automatic playback function? :) Ive got server with your addon, and I want to play my songs automaticaly when I am not in server... This would be great feature.

Offline LuaTenshi

  • Hero Member
  • *****
  • Posts: 545
  • Karma: 47
  • Just your ordinary moon angel!
    • Mirai.Red
Are there any more updates planned for this? Because I have a few ideas for this.

Code: [Select]
1. Players should be able to vote, if they want to play music server side.
2. When music is played server side the mics on the server should be dimmed. ( as in made quieter. )
^ I know this will kinda be offset because of Youtube loading, but this brings me to the next suggestion...
3. The ability to pre-load a video before it actually plays. This can probably be done with internet cache files, and then the video will be played from the clients cache instead of using the internet.
4. Entities, I thought a cool feature would be is for a radio entity, one that has initial volume, and distance offset. What I mean is, that people who are 2 far away from the radio will not hear the music. In fact the music wont even be loading for them. But people who are close will be able to hear it, at in altered volume based on distance.

I am willing to make 1 and 2, but I have no idea how to do 3 and 4. o3o

I cry every time I see that I am not a respected member of this community.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Could have sworn I saw #4, or at least something extremely like it, on Krook's server one time. Thought it was this release. Though I don't think it wasn't loading/playing on the 'distance' player, I do remember it wasn't heard.

Krooks, you read new threads? Was it this addon? Or another Youtube addon? Or was it a custom mix of Youtube addons?

Whatever it was, you could 'attach' youtube vids to several objects. Plasma TVs, the old timey tv from HL2, overhead projector and CSS office projector (would 'project' the vid onto a wall), and I think a little radio if sound only.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline LuaTenshi

  • Hero Member
  • *****
  • Posts: 545
  • Karma: 47
  • Just your ordinary moon angel!
    • Mirai.Red
Could have sworn I saw #4, or at least something extremely like it, on Krook's server one time. Thought it was this release. Though I don't think it wasn't loading/playing on the 'distance' player, I do remember it wasn't heard.

Krooks, you read new threads? Was it this addon? Or another Youtube addon? Or was it a custom mix of Youtube addons?

Whatever it was, you could 'attach' youtube vids to several objects. Plasma TVs, the old timey tv from HL2, overhead projector and CSS office projector (would 'project' the vid onto a wall), and I think a little radio if sound only.

Your talking about PlayX, but I was thinking some thing more realistic, with dynamic sound for RP or some thing...

Also I noticed that its not really working on my server... its like the video is paused or some thing...

You should use an external hackish thing that lets you embed, any thing. ( Like PlayX. )
I cry every time I see that I am not a respected member of this community.