Youtube TV

From Second Life Wiki
Revision as of 15:33, 9 August 2009 by Morgam Biedermann (talk | contribs) (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...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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!