Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

YouTube in SL

Baron Hauptmann
Just Designs / Scripter
Join date: 29 Oct 2005
Posts: 358
08-13-2008 07:46
I am trying to figure out the secret/trick. I know that to watch YouTube videos in SL, you can follow Torley's instructions, install a bookmarklet in your browser and get the link you need to watch a YouTube video. But is there a way to automate it? I know there is, since I have seen YouTube players in SL. But I have not figured out the process.

Here is what I know. . .
Each video can be accessed on the YouTube site with a particular URL, like
http://www.youtube.com/watch?v=cXXm696UbKY

But to watch it in SL, it needs to be as an .mp4, which has a simliar URL, but a hash added:
http://www.youtube.com/get_video?fmt=18&video_id=cXXm696UbKY&t=OEgsToPDskKDodvEnGvnswciyqOiaGwl

What I do not know is how to get that hash (the "t=";) automatically. I can find it in the page source for that video, but do not know how to get it out . . .

Is there something I can do strictly from LSL, or do I need a webserver that has a simple PHP program to receive a request from SL, mine that information, and send it back to SL?

Or am I totally barking up a wrong tree?

Thanks,
Baron
Ron Khondji
Entirely unlike.
Join date: 6 Jan 2007
Posts: 224
08-13-2008 08:24
From: Baron Hauptmann

or do I need a webserver that has a simple PHP program to receive a request from SL, mine that information, and send it back to SL?


Yes.

At least as far as I know.
It's also how I did it :)
Haruki Watanabe
llSLCrash(void);
Join date: 28 Mar 2007
Posts: 434
08-13-2008 09:26
The problem is, that the hash is to far down the youtube page to extract it with LSL (the infamous 2kb-limit)... If the hash would be persistent, it wouldn't be a problem, actually, but it changes every 5 minutes or so...

I am still waiting for the extra-header in the llHTTPRequest, where I could add the «Content-Range»-header - that'd be EXTREMELY helpful :)
(tried to sneak this header into a llHTTPRequest, but with no luck so far...)
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
08-13-2008 14:19
You could implement your own server script somewhere (PHP, Perl, etc.) to extract the hash from the YouTube page and return it to the LSL script. Basically a kind of proxy filter.
Vlad Bjornson
Virtual Gardener
Join date: 11 Nov 2005
Posts: 650
08-13-2008 19:20
I've been trying this as well, mostly just because it is a neat trick. :) I know what is needs to be done I just haven't got it figured on the web end, yet.

One problem I think I had with my first few attempts is that I was trying to figure out the LSL HTTP commands and the Youtube API coding at the same time. I think an easier approach might just be to read the page, maybe via PHP, and grab that Hash code right from the page source.

I think that a script that worked via the API would be more likely to work long term, or at least need fewer adjustments if YouTube changed the layout/structure of the video page. Grabbing the code from the page rather than via the API might violate YouTube's terms of service as well.
_____________________
I heart shiny ! http://www.shiny-life.com
Fire Centaur
Creator
Join date: 2 Nov 2006
Posts: 149
03-28-2009 15:13
Hello everyone,

I am a research assistant for the Educational and Opensource SLOODLE project, funded by Eduserve in the UK.

Currently, we have a Presenter module that can be added to MOODLE Learning management systems, that allows Second Life educators to create presentations on their Course websites. Currently, our presenter can stream .mov files, webpages, and images into SL - which allows educators to compose their entire presentation online, while avoiding costly texture uploads.

Id love to integrate the possiblity of streaming youtube directly into sl for educators around the globe.

As you may know, MOODLE runs on PHP, and our SLOODLE system can authenticate SL objects to interact with MOODLE activities on their servers.

If you have therefore, already successfully managed to create php /lsl code to bring Youtube into SL - we'd love a GPL 3.0 contribution to our code source. Having this feature added to our presenter could highly benefit Educators in SL.

please let me know if you can help! Would save me a lot of Dev time, and also be highly benefitial to the SL community.

Thanks!

Sincerely

Fire centaur
_____________________
Second Life to your Facebook Profile!
http://www.facebook.com/p.php?api_key=00b8153d7f12a4c7228b6c927fb2c537
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
03-28-2009 21:03
Torley has a video that shows you how to get youtube videos playing in Second Life.
_____________________
My tutes
http://www.youtube.com/johanlaurasia
ElQ Homewood
Sleeps Professionally
Join date: 25 Apr 2007
Posts: 280
03-29-2009 04:26
I went the other way round. my youtube urls are held in a notecard and the dialog menu is created from that notecard. The user chooses the video they want to watch from the dialog menu and the parcel media url is changed to the youtube url, and the video is served.
Landing Normandy
Proposing 4968
Join date: 28 Nov 2005
Posts: 240
04-04-2009 10:12
I do much the same thing. You save YouTube URLs in a notecard, but everything else is generated from YouTube data. I have to process the page itself, rather than any API, and I do it with PHP.
_____________________
<VOTE PROPOSITION 4968/>
http://jira.secondlife.com/browse/VWR-4968
For SecondLife Builders who need better mapping for better building
Mandy Medusa
Registered User
Join date: 21 Jan 2007
Posts: 118
09-03-2009 05:30
..... and it seems youtube changed the way it works. I can still get at the signature hash from the source page (using an external server to harvest) but the signature no longer seems to work.

It seems that they changed it so the IP address requesting the page (my web server doing the harvesting on my SL TV's behalf) and the IP address of the item thats going to play the video (my PC's quicktime plugin ordered to do so by SL) are NOT the same of course: It seems yooutube is checking for these two Ip addresses to be the same.

Anyone did some research on how to solve this?