Difference between revisions of "Youtube TV"

From Second Life Wiki
Jump to navigation Jump to search
(Created page with 'To make a YouTube TV you only need 2 scripts, each one in one prim: '''Get Video.lsl''' <lsl> integer listenid; default { touch_start(integer i) { if(llDetected...')
 
Line 32: Line 32:


'''Get Texture.lsl'''
'''Get Texture.lsl'''
[lsl>
<lsl>
default
default
{
{

Revision as of 15:34, 9 August 2009

To make a YouTube TV you only need 2 scripts, each one in one prim:

Get Video.lsl <lsl> integer listenid;

default {

   touch_start(integer i)
   {
       if(llDetectedKey(0) == llGetOwner())
       {
           llOwnerSay("Please type: /65 (Youtube video id) Example: Video URL: http://youtube.com/video?v=blablabla Video ID: blablabla");
           listenid = llListen(65, "", llGetOwner(),"");
       }
   }
   listen(integer c, string n, key k, string m)
   {
       llListenRemove(listenid);
       if(k == llGetOwner())
       {
           llHTTPRequest("http://secondtools.ismywebsite.com/youtube/getvideotext.php?v="+m,[],"");
       }
   }
   http_response(key requestid, integer status, list metadata, string body)
   {
       llOwnerSay("Connecting...");
       llParcelMediaCommandList([PARCEL_MEDIA_COMMAND_URL,body]);
   }

} </lsl>

Get Texture.lsl <lsl> default {

   state_entry()
   {
       
   }
   
   touch_start(integer i)
   {
       if(llDetectedKey(0) == llGetOwner())
       {
           llOwnerSay("Getting Parcel Media Texture...");
           string landTexture;
           landTexture = (string) llParcelMediaQuery([PARCEL_MEDIA_COMMAND_TEXTURE]);
           llSetTexture(landTexture,ALL_SIDES);
       }
   }

} </lsl>

Now is only sit and watch your favorite Youtube videos!