Tabletop Simulator

Tabletop Simulator

Not enough ratings
Custom Music Player
   
Award
Favorite
Favorited
Unfavorite
Number of Players: 1, 2, 3, 4
Assets: Scripting
File Size
Posted
Updated
28.797 KB
9 Apr, 2018 @ 8:26am
9 Apr, 2018 @ 9:54am
2 Change Notes ( view )

Subscribe to download
Custom Music Player

Description
📌 I realize this is a popular workshop item and will keep it up on the workshop for posterity.
However I will no longer offer support for it as there have since been several additions and implementations that supersede it's functionality. Everything below is to be considered legacy information that may not be accurate or valid anymore. Thank you for your understanding.


What is it?
This project allows users to add custom MP3s, YouTube and Soundcloud (and most other supported formats/autoplaying music or videos) to a playlist and play them back inside of TTS.

Features include:
  • Configurable playlists through in game input or LUA tables
  • Continuous playback based on track lenght
  • Back/Forward/Stop/Shuffle functionality in game
  • Play/Pause and Volume Up/Down through the web UI
  • Custom MP3s - more on that in how it works.
  • Self contained in a thematic dock for the tablet
  • Preconfigured tablets with playlists are plug and play

How to use it
This is an asset that requires customization and user input. Though there is a playlist encoded for demonstration purposes, this is only to show you how to pilot it.

Put your tablet on the dock. You will be prompted with the instructions page.
You can now hit the round button on the left to bring out the menu for adding tracks to your playlist.

Your music strictly needs to be uploaded and hosted online.
The Name field is optional but the Duration and URL fields are not.
Input your URL (link to your mp3 file), Name and Duration (i.e 3:42) in to their respective input fields.
The tablet supports MP3 files as well as YouTube/Soundcloud links and will create a playlist based on your inputs. This will encode the playlist to this tablet specifically, so keep it nearby if you want to save or re-use your playlists.

Included on the demonstration tablet is an encoded playlist of the NCS: Infinity album.
For more in depth editing of playlists i.e deleting tracks, edit the LUA table encoded on to your tablet.
Table entries are added as in the example below.

{ url = 'http://chry.me/NCS_Infinity/15%20-%20You.mp3', name = 'You', length = '4:19', },

Editing the LUA table is recommended for heavier and more in depth customization of playlists.

To create and use a new tablet, press the power button to unlink the current tablet and drop a new one on to the dock.

It is strongly recommended that you lock the dock down. It might also be beneficial to be mindful of filesizes of your input tracks to account for slower loading times.

Ticking the "Don't ask again for this player" prompt is also highly recommended as each track will open up a new page and otherwise prompt you with another popup. For multiplayer use, be mindful of the permission system and who you play with. The dock will not prompt you to open any malicious files or websites except through user input, it is your reponsibility as the host to keep your clients in check.

How it works
Traditionally playing straight MP3's doesn't work natively in the tablet as the plugin creator did not licence MP3/h264. However this can be circumvented by using a javascript wrapper to play back the audio.

The user inputs a URL > The LUA script appends it to my PHP script > The PHP script takes the URL of the track and wraps it in javascript playAudio() > MP3 now works in the tablet

MrStump also wrote a lot of other LUA functionality such as duration tracking, in game inputs, positional failsafes among all the other LUA oriented features. Give him a hug and maybe a workshop follow, he deserves it. > https://gtm.steamproxy.vip/id/MrStump

Customization
I've made a basic customizable box for storing tablets in so you can keep an organized library of songs.

It is imported in the workshop submission, but you can also grab the files from here:
Box model: http://chry.me/tts/musicplayer/tablet_box.obj
UV Template: http://chry.me/tts/musicplayer/box_uv.png

Extras and Info
All your music needs to be hosted and available online. There are a wide range of available public filehosts so I will not be picking and choosing any favorites. I will not host anything for you, it is your responsibility to keep your music hosted online. Help eachother out in the comment section, but keep in mind that you are responsible for the content you host and use.

You can use the web player as a standalone website, though without playlist functionality. Otherwise, the dock holds all the LUA (and the tablets hold the playlists) so both are always needed for the full intended functionality.

Currently I can not offer proper play/pause with communication through LUA/WEB, but it is a work in progress and might be added later down the line when I have more time to work on webrequests.

Local files are not supported for the obvious reason of clients not being able to hear it and the web app in most cases not recognizing it.

The script can be sensitive with URLs containing the word "MP3" in the middle of the string and the ' symbol, as it uses these symbols for formatting a table. Be mindful of this with your links and filenames.

Allow the tablet to run through it's scripts before using and manipulating more inputs. We can not realistically account for you being impatient.


[ PATREON ][www.patreon.com]
Special thanks to my (current and past) Patreon supporters for supporting my projects:
  • Jeremy. S
  • Platypus
  • Corrodias
  • Ash Black
  • Connor

Official Discord: https://discord.gg/d2w8jcp
5 Comments
🅽🅸🅴🅼🅰🅽🅳 10 Apr, 2018 @ 12:45pm 
WOW GREAT WORK!!!
darleth 10 Apr, 2018 @ 1:08am 
thanks a lot...
ulia  [author] 9 Apr, 2018 @ 4:01pm 
As the browser runs as a standalone app in the background, clients can actually change the volume of the music by adjusting the level of ZFGameBrowser in the volume mixer.

Refer to the LUA editing, it is just a table. We opted to not add in deletion of tracks because it is clunky and convoluted as is, but if you want to poke around in the code and find an elegant solution to managing the table with LUA buttons then by all means feel free to.

Ultimately though, most of this is as previously with the record player, just for show. I have been working on a standalone JS player that I will release separately that will bring more function over form in terms of playing back music in TTS.
Markimus 9 Apr, 2018 @ 3:55pm 
Also, how can I remove playlist entries?
Markimus 9 Apr, 2018 @ 3:52pm 
Hey, thanks for this!

I noticed that volume changes don't sync between tracks and there is no button on the Music Player itself to change the volume, so it makes it impossible for people to adjust the volume if the Host has Tablet disabled. Please could you fix these issues?