# RCWeb Random Photo Control

**Random Photo Control** is the phone-friendly companion to the **random-photo** viewer. It lets one or more phones cycle through the current Unsplash slideshow, pause and resume auto-advance, and see richer details for the photo currently on the display.

## What it does

- Shows a thumbnail of the active photo
- Shows linked photographer and Unsplash attribution
- Shows description, creation date, location, image size, and like count when supplied by the API
- Provides large touch buttons for **Prev**, **Play / Pause**, and **Next**
- Includes a link to the current photo on Unsplash

## RCWeb communication

The viewer owns all slideshow state. The control sends commands to the viewer:

```javascript
rc.sendFunctionCall("random-photo", "randomPhoto.prev");
rc.sendFunctionCall("random-photo", "randomPhoto.next");
rc.sendFunctionCall("random-photo", "randomPhoto.toggle");
rc.sendFunctionCall("random-photo", "randomPhoto.requestState", rc.client);
```

The viewer sends snapshots back to controls through the global callback:

```javascript
randomPhotoControl.receiveState(snapshot);
```

## Browser support

Written in ES5 with `XMLHttpRequest`-compatible state handling, simple flexbox controls, and conservative CSS for older mobile browsers.

## URL

`/random-photo-c/?r=<room>`
