Jump to content

Syncing Parcel Media Script


Evah Baxton
 Share

You are about to reply to a thread that has been inactive for 1538 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

You have to be the owner of the parcel.
You need to have Auto-play Media and Script Auto-play Media enabled for it to behave like in the video.
You can stop and start your media, leave the parcel, or logout and log back in and it will re-sync.  It will take 1 second to the amount of seconds you have set as the resync period (default 10 seconds).

This will override your media link and media texture settings on your parcel.

//Evah Baxton 2020

float timerCount=0;
integer videoLength=98; //video length in seconds
integer resync=10; //resync every 10 seconds
string mediaURL = "YOUR MEDIA HERE";
integer loop=1; //loop the synced video
integer displayTime=1; //display the seconds elapsed

default {

    state_entry() {
        llParcelMediaCommandList([
            PARCEL_MEDIA_COMMAND_STOP,
            PARCEL_MEDIA_COMMAND_URL,mediaURL,
            PARCEL_MEDIA_COMMAND_TEXTURE, (key) llGetTexture(0)
        ]);
    }

    touch_start(integer num_detected) {
        timerCount=0;
        llParcelMediaCommandList([
            PARCEL_MEDIA_COMMAND_STOP,
            PARCEL_MEDIA_COMMAND_URL,mediaURL,
            PARCEL_MEDIA_COMMAND_TEXTURE, (key) llGetTexture(0),
            PARCEL_MEDIA_COMMAND_TIME, timerCount,
            PARCEL_MEDIA_COMMAND_PLAY
        ]);
        llSetTimerEvent(0.15);
    }

    timer() {
        if(displayTime==1) {
            llSetText((string)timerCount, <1.0,0,0>,1.0);
        }
              
        if(llGetUnixTime()%resync==0) {
            timerCount=timerCount+resync;   
            llParcelMediaCommandList([
                PARCEL_MEDIA_COMMAND_TIME, timerCount
            ]);
        }
              
        if(timerCount >= videoLength) {
            timerCount=0;
            if(loop==0) {
                llSetTimerEvent(0.0);
            } else {
                llParcelMediaCommandList([
                    PARCEL_MEDIA_COMMAND_STOP,
                    PARCEL_MEDIA_COMMAND_PLAY
                ]);
            }
        }
              
    }
              
}

 

Edited by Evah Baxton
Link to comment
Share on other sites

2 hours ago, Evah Baxton said:

You have to be the owner of the parcel.
You need to have Auto-play Media and Script Auto-play Media enabled for it to behave like in the video.
You can stop and start your media, leave the parcel, or logout and log back in and it will re-sync.  It will take 1 second to the amount of seconds you have set as the resync period (default 10 seconds).

Just so I understand... this script is placed into the media prim (in your example: into the two televisions)?

Link to comment
Share on other sites

It needs a good server and a relatively good internet connection. It works much better when the video is smaller.

The first time any user plays the media, it takes a moment to sync and buffer from the server. Sometimes it takes two or three syncs to get fully caught up.

This public test video has worked well for me:
http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/WhatCarCanYouGetForAGrand.mp4

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1538 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...