API of Virtual Mirror HTML5

Virtual Mirror HTML5 API Documentation – Second Revision

A short explanation of the very simple API of Virtual Mirror HTML5

These parameters can be passed as key-value to Virtual Mirror HTML5, using GET:

vmjs.html?frameFile=/path/file-name
frameFile=xxxxxxx requires the location of a picture of the eyeglasses. For 3D *.glb or *.gltf is required, for 2D *.jpg or *.png. This should be loaded from the same domain. If no image was passed, Virtual Mirror will use a default image, defined inside of the configuration file.

vmjs.html?frameFile=/path/file-name&frameSize=141
frameSize=xxx is the frontal width of the eyeglasses by use of millimeters.
Based on this parameter the eyeglasses will be scaled by Virtual Mirror to match the real size.
If this parameter wasn’t passed Virtual Mirror will fall back to the default value of 135 mm. In result every eyeglasses will get the same size. So it’s important to pass this value.

vmjs.html?frameFile=/path/file-name&frameSize=141&frameName=Ray-Ban-Wayfarer
frameName=xxxxxxxxxxxxxxxx¬†will be used for the file name of a screen shot, taken by customers and saved on their device. The value should be urlencoded to translate possible spaces. If the name of the eyeglasses wasn’t provided Virtual Mirror will use ‘me-and-my-glasses’ instead as a fallback.

vmjs.html?frameFile=/path/file-name&frameSize=141&frameName=Ray-Ban-Wayfarer&gender=male
gender=xxxxxx will be used to change the default model by gender. Possible values are “female” and “male” , for children “girl” and “boy”. If the gender key-value pair isn’t provided Virtual Mirror will load the female model as a fallback.

vmjs.html?frameFile=/path/file-name&frameSize=141&frameName=Ray-Ban-Wayfarer&gender=male&lang=en
lang=xx defines the language of the GUI of Virtual Mirror. The value has to be defined as ISO 639-1.

Since January 2022 Virtual Mirror was translated to Arabic (ar), German (de), English (en), Spanish (es), French (fr), Greek (gr), Hebrew (he), Dutch (nl), Portuguese (pt), Romanian (ro), Russian (ru) and Slovenian (sl). As a fallback Virtual Mirror tries to get the language by the language tag defined for that web page.

2 comments

    1. Because this was programmed using WebAssembly you should reach at least 20 frames per second for 3d also with an average mobile phone.

      You may have a slow Internet connection. The second call should be faster in any case because of the possible caching.

      Next? May be the installation on your hosting.

Leave a Reply

Your email address will not be published. Required fields are marked *