Lessonspace

Demo Space

If you're looking at using the API to integrate Lessonspace into your own app there's a good chance you'll want to show off your fancy spaces to your users. The Lessonspace API provides a simple endpoint that allows you to create your own demo space that you can easily embed in an iframe.

A demo space is transient. This means that - unlike a normal space created through the Launch API - its state will only be saved for a few minutes after the end of its session. So don't expect data within the space to be saved reliably between separate invocations.

Here's a simple example of embedding the demo space in an iframe using some basic HTML and Javascript:

  <iframe id="lessonspaceDemo"
    frameborder="0"
    allow="camera; microphone; display-capture"
    src="about:blank">
  </iframe>
  // Check if the demo room we have stored (if we have one) is
  // valid or get a new empty demo room
  var stored = localStorage.getItem('demoRoom');
  if (!stored || stored.indexOf('room.sh') === -1) {
    stored = null;
  }
  fetch("https://api.thelessonspace.com/v2/demo/", {
    method: 'POST',
    headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({desired_room: stored})
  }).then(function (response) {
    response.json().then(function (j) {
        localStorage.setItem('demoRoom', j.url)
        document.getElementById("lessonspaceDemoiframe").src = j.url
    })
  });