YouTube Script 1.0

Written by: Headmaster
//
//    SHOP ZERO Tips29 YouTubePlayer  script   v1.0
//
//                   Created by Zero2000 Kid     2008/08/02
//
// https://blogs.secondlife.com/community/features/blog/2008/07/30/3-cool-tools-which-solve-common-second-life-problems
// http://www.youtubemp4.com/
 
string YouTubeURL="http://youtube.com/watch?v=QVIR1pNcow8";
string meaditexture="UUID HERE";
integer input_ch = -29;
integer handle;
 
default
{
    state_entry(){
        llSetTexture((key)meaditexture,ALL_SIDES);
        // URL convert
        list ulist=llParseString2List(YouTubeURL, ["watch?v="], []);
        string mediakey=llList2String(ulist,1);
        string url="http://www.youtubemp4.com/video/"+mediakey+".mp4";
        // Media initialize
        llParcelMediaCommandList( [
        PARCEL_MEDIA_COMMAND_URL, url,
        PARCEL_MEDIA_COMMAND_TEXTURE, (key) llGetTexture(0),
        PARCEL_MEDIA_COMMAND_AUTO_ALIGN,TRUE] );
    }
 
    touch_start(integer t) {
        handle = llListen(input_ch,"",llDetectedKey(0),"");
        llDialog(llDetectedKey(0), "PLEASE SELECT MENU",["PLAY","STOP","CANCEL"], input_ch);
    }
 
    listen(integer ch, string name, key id, string message) {
        if (message=="PLAY") {
            llWhisper(0,"YouTube play start...");
            llParcelMediaCommandList([PARCEL_MEDIA_COMMAND_PLAY]);
        } else if (message=="STOP") {
            llWhisper(0,"You Tube play stop.");
            llParcelMediaCommandList([PARCEL_MEDIA_COMMAND_STOP]);
        }
        llListenRemove(handle);
    }
}

 

Category: