sl-tv
sl-tv is an open source media player for second life. it allows you to play video & audio in a somewhat synchronized fashion with other users in-world.
- supports youtube, bandcamp and soundcloud
- playing, skipping, queueing
- can list what's playing, queue and history on request
- controlled via chat commands
visit github.com/furudean/sl-tv for code
commands
the screen listens for chat messages in chat, on a specific channel. by default, this channel is -1312
. you can change it if you need to by editing the script.
<url>
- play media from a url
- example:
/-1312 https://youtu.be/tN-C8-YZy24
playskip <url>
- play media from a url immediately, skipping the line
- example:
/-1312 playskip https://youtu.be/tN-C8-YZy24
np
- show what's currently playing
pause
- pause the current playback
resume
- resume the current playback
stop
- end the current session. this ejects any queued items.
seek <time>
- seek the current playback to a timestamp
- example:
/-1312 seek 1:30
skip
- jump to the next thing in the queue
sync
- sync all listeners to the current timestamp. this is useful if someone's lagging behind.
queue
/q
- show what's up next
history
/h
- show past things that were played
about
/info
/help
- show information about the screen
setup
the script tv.lsl should be placed in a prim that you want to be used as the TV. you may want to adjust any settings in the script, especially the channel.
you may also be interested in the remote.lsl script, which is a more user friendly way to control the TV via hud instead of chat.
the prim the media is projected on should have its dimensions set to a 16:9 aspect ratio to
display with the right aspect ratio. for example, <7.11, 1.0, 4.0>
.
media will play from face 3 by default (which usually corresponds to forward). the texture should be set to have a 16:9 aspect ratio. see second life documentation on faces for more information.
when the screen is playing something, the texture named on
in the prim will be
shown on the media face. conversely, the texture off
will be shown when nothing is playing.
feature helps inform people that something is playing, and how they can join in.
how it works
once the screen receives a command, it will parse the message and execute it. for some commands, this means contacting a web server to fetch information about the media you want to play.
an example of this is the play command, which will need to match the URL provided against a
metadata service. we use the endpoint /resolve
to do this, which is hosted on this website. for example,
/resolve?q=https://youtu.be/-zAbSroLfO
will respond with a payload like this:
{
"player_url": "/youtube/-zAbSroLfOs",
"source_url": "https://youtu.be/-zAbSroLfOs",
"title": "Bright Future Original Soundtrack - Jellyfish Theme",
"user": "Jasdko Sasjlas",
"duration": 280
}
the script will add this metadata to the queue, and then when its time to play, sets the media
url to player_url
. in this case, that would be
/youtube/-zAbSroLfOs. this is a slim page that embeds the
youtube video.
all media providers in sl-tv work similarly. here are some examples of hosted players
- /youtube/-zAbSroLfOs - youtube
- /bandcamp/86555894 - bandcamp
- /soundcloud/1594041948 - soundcloud