open-audiovisual
Search GitHub

oav-p5 reference · Loading options

room#

optionoav-p5
?oav_room=a room name

The name of the room phones join to play this page: by default one made up per browser.

A phone and a page meet in a room on the relay. Left empty, oav-p5 picks a name like p5-k3x9a the first time and keeps it in this browser (localStorage), so the same QR code keeps working on reload. If link is set, its room is used. Set room yourself when you want a name people can type or remember, such as one per class.

A phone needs only the room name to join, so pick a name people cannot guess if that matters. OAVp5.phone() returns the room in use.

Type
String
Values
a room name
default
'' (random per browser)

Left empty, a name like p5-k3x9a is made up and kept in this browser. Only letters, digits, _ and - are kept, and only the first 32 characters. If nothing is left, the room is default.

Notes

  • Set it before oav-p5 loads. window.OAV_P5 = { room: … }; above the loader line wins, then ?oav_room=… on the page address, then ?room=… on the script's own URL. Values in window.OAV_P5 are turned into text, so write 'off', not false. On OpenProcessing the page address takes ?sketch_oav_room=… (the project's README says OpenProcessing forwards it to the sketch).

Examples

jsOpenProcessing ↗
window.OAV_P5 = { room: 'class-2026' };

function setup() {
  createCanvas(400, 300);
}

function draw() {
  background(20);
  fill(255);
  text('room: ' + OAVp5.options.room, 20, 30);   // the phones' QR code uses this room
}
The sketch prints the room name. The 📱 card now shows class-2026 instead of a random name.

Related

  • relay The address of the relay that phones and link rooms talk through: a WebSocket URL.
  • link Joins a room: oav-p5 pages with the same room hear what each other's programs play, over the relay. A room name, or empty for none.
  • remote The address of the remote page that the 📱 QR code opens on a phone.
  • OAVp5.phone() Shows the 📱 card: a QR code that sends a phone to the remote page, whose MIDI tab then plays this sketch. Returns the room name.

p5/oav-p5.js, line 127

↑ Back to top · All names