Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // remember to have the prim sized something like 16:9 on x and z
- // set texture to full bright
- // right click the object and touch
- // choose the abbreviation
- // to insert videos in the video list just get the magic number from the youtube url
- // for instance if you have a video like https://www.youtube.com/watch?v=qGhN4g2YjN4 the magic number is what is at the right of v=.
- list videos = [
- "video1", "xk5uloijNxs",
- "video2", "qGhN4g2YjN4"
- ];
- integer listen_handle;
- integer LINKED=0;
- integer FACE =1 ;
- string URL;
- integer CHANNEL = 1;
- playURL() {
- llSay(0,"Playing "+URL);
- llClearLinkMedia(LINKED,FACE);
- llSetLinkMedia(LINKED,FACE,
- [PRIM_MEDIA_CURRENT_URL,
- URL,
- PRIM_MEDIA_AUTO_SCALE,
- TRUE,
- PRIM_MEDIA_AUTO_PLAY,
- TRUE,
- PRIM_MEDIA_AUTO_ZOOM,
- TRUE,
- PRIM_MEDIA_PERMS_CONTROL,
- PRIM_MEDIA_PERM_NONE,
- PRIM_MEDIA_WIDTH_PIXELS, 0,
- PRIM_MEDIA_HEIGHT_PIXELS, 0,
- PRIM_MEDIA_FIRST_CLICK_INTERACT, 1,
- PRIM_MEDIA_PERMS_INTERACT, 4,
- PRIM_MEDIA_PERMS_CONTROL, 4]);
- }
- stop(){
- llClearLinkMedia(LINKED,FACE);
- }
- default
- {
- state_entry()
- {
- listen_handle = llListen(CHANNEL, "", NULL_KEY, "");
- }
- touch_start(integer count){
- llDialog(llDetectedKey(0),"Scegli video", llList2ListStrided(videos,0,-1,2) + ["go","stop"],CHANNEL);
- }
- listen( integer channel, string name, key id, string message )
- {
- llSay(0,"received "+message);
- integer index = llListFindList(videos,[message]);
- llSay(0,"index is "+(string)index);
- if(index>=0){
- string youtubeId = llList2String(videos,index+1);
- URL = "http://www.youtube.com/embed/"+youtubeId+"?rel=0&autoplay=1;fs=0;autohide=1;hd=1;";
- }
- else if(llToLower(message)=="stop"){
- URL = "";
- stop();
- return;
- }
- playURL();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement